Repository navigation
SONARJAVA-7153: Implement S9427 — Java assert statements should not be used in test code - #6322
Conversation
…not be used in test code Detects Java assert statements in explicitly annotated JUnit 4, JUnit Jupiter, and TestNG test methods.
This comment has been minimized.
This comment has been minimized.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
/pvf |
|
📊 Performance Validation complete |
…tract test variables Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…R #8321) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Code Review ✅ Approved🟡 Medium risk · Adding S9427 to flag native asserts in annotated tests could introduce unexpected issues that affect analysis results or quality gates. Adds rule S9427 to flag Java Verification Repos 4 inspectedFunctional validation No results Rules No rules evaluated Cross-repo 4 repositories inspected 0 open impacts
Auto-approval Not enabledFor more verification details, comment OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
|
|
@rombirli RSpec PR SonarSource/rspec#8321 is now green (required checks and Validate Rules pass). I also added the missing |




Summary
teststag required for test-only rules) and Sonar way profile registration.Out of scope
assertwith framework assertions (assertEquals/assertTrue/assertNull) is not part of this PR and can be done in a follow-up.Validation
GeneratedCheckListTestpasses locally.🤖 Generated with Claude Code
Agent workflow
Tool link: https://github.com/SonarSource/languages-experimental-tooling/tree/romain/my-tickets/personal/romain-brenguier
PR created using
uv run create_with_claude.py /tmp/action_plan_romain/new-rule-s9427-sonarjava-7153.txtIterated on the PR with
uv run ci_loop.pyfor 1 iterations.✔️ The PR is now ready for review.
Addressed review comments in pr_report_6322.md using
uv run address_reviews.py pr_report_6322.mdPR updated using
uv run update_with_claude.py --prompt "Implement the action plan described in the document Repull the rspec metadata from the PR https://github.com/SonarSource/rspec/pull/8321." -a "Repull the rspec metadata from the PR https://github.com/SonarSource/rspec/pull/8321" -g "claude"PR updated using
uv run update_with_claude.py --prompt "Implement the action plan described in the document /tmp/action_plan_romain/new-rule-s9427-sonarjava-7153.txt." -a "/tmp/action_plan_romain/new-rule-s9427-sonarjava-7153.txt" -g "claude"Iterated on the PR with
uv run ci_loop.pyfor 1 iterations.✔️ The PR is now ready for review.