SONARJAVA-6442 Introduce SpringContextModelGatherer and SpringContextModelSensor#5654
Conversation
Agentic Analysis: Early ResultsAgentic Analysis and Context Augmentation are available on your project. Here are some issues that could have been prevented. Follow the links to learn how to put them into action. 2 issue(s) found across 2 file(s):
Analyzed by SonarQube Agentic Analysis in 4.2 s |
89ad9fe to
b7d2953
Compare
b7d2953 to
cff1689
Compare
✅ Code review updated (blocking issues remain unresolved).
| /** | ||
| * Method called at the end of the analysis of a module, allowing to store gathered data in the SpringContextModel. | ||
| */ | ||
| public abstract void gatherSpringContextData(SpringContextModel springContextModel); |
There was a problem hiding this comment.
Add parameter: ModuleScannerContext context
7931bd5 to
572961e
Compare
asya-vorobeva
left a comment
There was a problem hiding this comment.
Generally LGTM, please fix QG failures before merge. And rebase to master to fix broken CI (was fixed in https://github.com/SonarSource/sonar-java/pull/5658/changes).
12dd139 to
b2feb69
Compare
81559d4 to
f4a3d98
Compare
b2feb69 to
6bbc6af
Compare
6bbc6af to
f434514
Compare
f434514 to
6f2b7c8
Compare
|
9251ba1
into
epic-SONARJAVA-6237
Code Review ✅ Approved 6 resolved / 6 findingsIntroduces SpringContextModelGatherer and SpringContextModelSensor for cross-module data analysis, but mutable state leaks in the scanner component currently prevent correct behavior in SonarLint. ✅ 6 resolved✅ Bug: SpringContextModel is @ScannerSide-only but required by JavaSensor in SonarLint
✅ Bug: Sample gatherer accumulates state across modules without reset
✅ Quality: New gatherer/sensor functionality has no test coverage
✅ Quality: New test files missing SonarSource license header
✅ Quality: Debug System.out.println left in production sensor
...and 1 more resolved from earlier reviews OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |


SpringContextModel is now a ScannerSide component living across modules and plugged into the DefaultModuleScannerContext (for gathering data) and the SpringContextModelSensor (for issue reporting, after all modules)
Added SpringContextModelGatherer abstract class that allows subclasses to visit the AST and to gather spring-related data at the end of a module analysis, inside the SpringContextModel.
Summary by Gitar
S8714: Identifiestry-catchblocks withfail()calls that should be replaced byassertThrowsorassertDoesNotThrow.S8715: Prohibits the use of JUnit 4 assertions within JUnit 5 test classes to ensure consistency and correct failure message handling.S8745: Enforces that classes contain at most one lifecycle method per annotation type (@BeforeEach,@AfterEach, etc.) to guarantee predictable execution.UnitTestUtilsto better identify JUnit 5 annotations and fail-method invocations, and updatedSuppressWarningFilterto handle lowercase rule names.try-catch-failblocks with AssertJ'sassertThatThrownByandassertThatCodefor more robust testing.This will update automatically on new commits.