Add management command to detect non-compliant project levels and apply score penalty#3383
Add management command to detect non-compliant project levels and apply score penalty#3383anurag2787 wants to merge 0 commit intoOWASP:mainfrom
Conversation
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughThis PR introduces a database schema change to support project-level compliance tracking by adding a new boolean field ( Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
`@backend/tests/apps/owasp/management/commands/owasp_update_project_health_scores_test.py`:
- Line 84: Add a trailing newline at the end of the test file
owasp_update_project_health_scores_test.py (the file containing the assertion
"assert 'Updating score for project: Test Project' in self.stdout.getvalue()")
so the file ends with a newline character to satisfy Ruff W292; simply ensure
the final line is terminated with '\n' and commit the change.
| assert mock_metric.score == EXPECTED_SCORE | ||
| assert "Updated project health scores successfully." in self.stdout.getvalue() | ||
| assert "Updating score for project: Test Project" in self.stdout.getvalue() | ||
| assert "Updating score for project: Test Project" in self.stdout.getvalue() No newline at end of file |
There was a problem hiding this comment.
Add trailing newline to satisfy Ruff W292.
Static analysis flags a missing newline at end of file.
🔧 Proposed fix
- assert "Updating score for project: Test Project" in self.stdout.getvalue()
+ assert "Updating score for project: Test Project" in self.stdout.getvalue()
+📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| assert "Updating score for project: Test Project" in self.stdout.getvalue() | |
| assert "Updating score for project: Test Project" in self.stdout.getvalue() | |
🧰 Tools
🪛 Ruff (0.14.11)
84-84: No newline at end of file
Add trailing newline
(W292)
🤖 Prompt for AI Agents
In
`@backend/tests/apps/owasp/management/commands/owasp_update_project_health_scores_test.py`
at line 84, Add a trailing newline at the end of the test file
owasp_update_project_health_scores_test.py (the file containing the assertion
"assert 'Updating score for project: Test Project' in self.stdout.getvalue()")
so the file ends with a newline character to satisfy Ruff W292; simply ensure
the final line is terminated with '\n' and commit the change.
f86e75e to
9f00b94
Compare
|



Proposed change
This PR adds a management command that periodically compares local project levels with the official project_levels.json if a mismatch is found, the project is marked as non-compliant and a penalty is applied to its health score.
Resolves #2039
Checklist
make check-testlocally: all warnings addressed, tests passed