-
-
Notifications
You must be signed in to change notification settings - Fork 274
Create a health evaluation criteria #1550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
arkid15r
merged 43 commits into
OWASP:main
from
ahmedxgouda:dashboard/health-evaluation
Jun 15, 2025
Merged
Changes from 4 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
c319404
Creating a command to update metrics - initial step
ahmedxgouda a46b9e4
Add missing properties to the project model and update the metrics sc…
ahmedxgouda 5984ea2
Merge branch 'main' into dashboard/health-evaluation
ahmedxgouda fdec122
Apply make-check and check-spelling
ahmedxgouda 032abbd
Update tests
ahmedxgouda eca8635
Apply coderabbitai suggestion
ahmedxgouda 23eb00a
Add is_funding_requirements_compliant to the metrics script
ahmedxgouda bcedde3
Apply coderabbitai suggestion
ahmedxgouda 5bcd9b8
Add owasp_page_last_updated_at to the metrics
ahmedxgouda 8110192
Refactor is_funding_requirements_compliant logic
ahmedxgouda 58865cb
Add command to calculate score
ahmedxgouda 8d6c3c0
Remove TODO
ahmedxgouda f7beaaf
Add metrics test
ahmedxgouda cbbd63f
Add metrics_score test
ahmedxgouda c515b51
Update metrics test
ahmedxgouda dfac905
Merge branch 'main' into dashboard/health-evaluation
ahmedxgouda 9d30c8e
Merge branch 'main' into dashboard/health-evaluation
kasya 3788253
Merge branch 'main' into dashboard/health-evaluation
ahmedxgouda fd0688d
Apply suggestions and add tests
ahmedxgouda 5452beb
Rename score script to be plural
ahmedxgouda c85e2ea
Change the logic to create multiple ProjectHealthMetrics objects for …
ahmedxgouda acf0c66
Merge branch 'main' into dashboard/health-evaluation
ahmedxgouda 56f3cf3
Apply coderabbitai suggestion
ahmedxgouda 8845db3
Merge branch 'main' into dashboard/health-evaluation
ahmedxgouda 9cea493
Merge branch 'main' into dashboard/health-evaluation
ahmedxgouda 891074d
Make open issues count negative direction
ahmedxgouda f5b4514
Merge branch 'main' into dashboard/health-evaluation
ahmedxgouda 9faf664
Evaluate the funding and project leaders requirement in the score and…
ahmedxgouda 1e70ad7
Merge branch 'main' into dashboard/health-evaluation
kasya dc7adcd
Apply suggestions
ahmedxgouda 8edde6d
Merge branch 'main' into dashboard/health-evaluation
ahmedxgouda c6a7061
Merge branch 'main' into dashboard/health-evaluation
ahmedxgouda a2eaf7a
Apply coderabbitai suggestion
ahmedxgouda b49f80d
Apply coderabbitai suggetion
ahmedxgouda 4f24790
Fix tests
ahmedxgouda 1702e50
Update code
arkid15r e4d661a
Merge branch 'main' into dashboard/health-evaluation
arkid15r 8dabe94
Apply suggestions
ahmedxgouda 1918428
Fix if condition
ahmedxgouda b787163
Merge branch 'main' into pr/ahmedxgouda/1550
arkid15r 9c555c8
Update code
arkid15r 5d1d1aa
Merge branch 'main' into dashboard/health-evaluation
arkid15r 56231b9
Make older projects have higher scores
ahmedxgouda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
backend/apps/owasp/management/commands/owasp_update_project_health_metrics.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| """A command to update OWASP project health metrics.""" | ||
|
|
||
| from django.core.management.base import BaseCommand | ||
|
|
||
| from apps.owasp.models.project import Project | ||
| from apps.owasp.models.project_health_metrics import ProjectHealthMetrics | ||
|
|
||
| MINIMUM_LEADERS = 3 | ||
|
|
||
|
|
||
| class Command(BaseCommand): | ||
| help = "Update OWASP project health metrics." | ||
|
|
||
| def handle(self, *args, **options): | ||
| projects = Project.objects.all() | ||
| field_mappings = { | ||
| "contributors_count": "contributors_count", | ||
| "created_at": "created_at", | ||
| "forks_count": "forks_count", | ||
| "last_released_at": "released_at", | ||
| "last_committed_at": "pushed_at", | ||
| "open_issues_count": "open_issues_count", | ||
| "open_pull_requests_count": "open_pull_requests_count", | ||
| "pull_request_last_created_at": "pull_request_last_created_at", | ||
| "recent_releases_count": "recent_releases_count", | ||
| "stars_count": "stars_count", | ||
| "total_issues_count": "issues_count", | ||
| "total_pull_requests_count": "pull_requests_count", | ||
| "total_releases_count": "releases_count", | ||
| "unanswered_issues_count": "unanswered_issues_count", | ||
| "unassigned_issues_count": "unassigned_issues_count", | ||
| } | ||
| for project in projects: | ||
| self.stdout.write(self.style.NOTICE(f"Updating metrics for project: {project.name}")) | ||
| metrics = ProjectHealthMetrics.objects.get_or_create(project=project)[0] | ||
|
|
||
| # Update metrics based on requirements | ||
| # TODO(ahmedxgouda): update from owasp page: owasp_page_last_updated_at | ||
| # TODO(ahmedxgouda): update is_funding_requirements_compliant, | ||
| # TODO(ahmedxgouda): add score | ||
| for metric_field, project_field in field_mappings.items(): | ||
| value = getattr(project, project_field) | ||
| setattr(metrics, metric_field, value) | ||
|
|
||
| is_leaders_compliant = project.leaders_count >= MINIMUM_LEADERS | ||
| metrics.is_project_leaders_requirements_compliant = is_leaders_compliant | ||
| metrics.save() | ||
|
|
||
| self.stdout.write(self.style.SUCCESS("Project health metrics updated successfully.")) | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
17 changes: 17 additions & 0 deletions
17
...ns/0035_rename_total_pull_request_count_projecthealthmetrics_total_pull_requests_count.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Generated by Django 5.2.1 on 2025-06-03 14:47 | ||
|
|
||
| from django.db import migrations | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ("owasp", "0034_alter_chapter_leaders_and_more"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.RenameField( | ||
| model_name="projecthealthmetrics", | ||
| old_name="total_pull_request_count", | ||
| new_name="total_pull_requests_count", | ||
| ), | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,7 @@ WSL | |
| Whistleblower | ||
| Wörld | ||
| a2eeef | ||
| ahmedxgouda | ||
| algoliasearch | ||
| ansa | ||
| apk | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a comment on what it is, and why is 3?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it should be 2, it was stated in the description of the original idea: #711
