SONARJAVA-4926: Use secondary locations for class-level @Transactional issues#5786
SONARJAVA-4926: Use secondary locations for class-level @Transactional issues#5786romainbrenguier wants to merge 3 commits into
Conversation
d4c4d27 to
7563d81
Compare
Code Review 👍 Approved with suggestions 1 resolved / 2 findingsRefactors S8989 to report issues on individual methods with secondary locations pointing to the class-level 💡 Quality: .gitignore adds unrelated tool-specific entriesThe second commit adds ✅ 1 resolved✅ Bug: Secondary-location markers are never verified in tests
🤖 Prompt for agentsOptionsAuto-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 |
…issues When a @transactional annotation is on a class and multiple methods throw checked exceptions without rollback configuration, instead of raising multiple issues on the same annotation, we now: - Report the issue on each affected method name (primary location) - Show the class-level annotation as a secondary location - Provide a clearer message indicating the configuration needs to be added to the class-level annotation This makes it clearer which methods are affected and where the fix needs to be applied. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Now all issues have a secondary location pointing to the @transactional annotation that needs to be configured, making it immediately clear where the fix should be applied. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The Noncompliant comment format requires custom messages to be on a separate line when used with secondary locations. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
d7adc70 to
2e65d04
Compare
Code Review ✅ Approved 2 resolved / 2 findingsRefactors S8989 to report issues on individual methods with class-level secondary locations, resolving the previous issue of repetitive reporting. Test validation for secondary location markers has been successfully implemented. ✅ 2 resolved✅ Bug: Secondary-location markers are never verified in tests
✅ Quality: .gitignore adds unrelated tool-specific entries
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 |
Code Review ✅ Approved 2 resolved / 2 findingsRefactors S8989 to report issues on individual methods with class-level secondary locations, resolving the previous issue of repetitive reporting. Test validation for secondary location markers has been successfully implemented. ✅ 2 resolved✅ Bug: Secondary-location markers are never verified in tests
✅ Quality: .gitignore adds unrelated tool-specific entries
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 |
|




Summary
Improves the reporting of S8989 (TransactionalMethodCheckedExceptionCheck) when a
@Transactionalannotation is at the class level.Problem
When a
@Transactionalannotation is on a class and multiple methods throw checked exceptions without rollback configuration, the previous implementation raised multiple issues on the same annotation, which was confusing.Solution
Instead of raising multiple issues on the annotation:
This makes it immediately clear:
Example
Before:
After:
Testing
🤖 Generated with Claude Code
Summary by Gitar
TransactionalMethodCheckedExceptionCheckto identify and report issues on the affected method name when@Transactionalis class-level.@Transactionalannotation to clarify where configuration is required.TransactionalMethodCheckedExceptionCheckSampleto include secondary location metadata in existing test cases.sonar_code_context.mdc,SONAR.md,settings.json) to the repository.This will update automatically on new commits.