SONARJAVA-6222 Extend ProfileRegistrar to register rules for specific quality profiles#5749
Conversation
a399fcb to
d1e41fe
Compare
Code Review 👍 Approved with suggestions 3 resolved / 4 findingsExtends the ProfileRegistrar interface to support rule registration for specific quality profiles, improving isolation between profile implementations. The debug log regarding skipped registration should be guarded to match the actual execution flow. 💡 Quality: Debug log claims to skip but doesn't guard registration📄 sonar-java-plugin/src/main/java/org/sonar/plugins/java/BuiltInJavaQualityProfile.java:92-97 The log message says "skipping rules registration" but the code does not actually branch/return based on ✅ 3 resolved✅ Quality: Test double diverges from production for unknown profile names
✅ Edge Case: Rules registered for unknown profile name are silently dropped
✅ Bug: Path.of().toString() breaks classpath resource loading on Windows
🤖 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 |
04c96e5 to
13c1f01
Compare
13c1f01 to
6656768
Compare
|
Code Review ✅ Approved 4 resolved / 4 findingsExtends the ProfileRegistrar interface to support rule registration for specific quality profiles, ensuring isolation between profiles. Resolved issues regarding path handling, logging, and inconsistent test behavior. ✅ 4 resolved✅ Quality: Test double diverges from production for unknown profile names
✅ Edge Case: Rules registered for unknown profile name are silently dropped
✅ Bug: Path.of().toString() breaks classpath resource loading on Windows
✅ Quality: Debug log claims to skip but doesn't guard registration
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 by Gitar
registerRules(String qualityProfileName, Collection<RuleKey> ruleKeys)toProfileRegistrar.RegistrarContext.registerDefaultQualityProfileRulesto delegate toregisterRulesfor the "Sonar way" profile.BuiltInJavaQualityProfileto filter registered rules by profile name and avoid leakage between profiles.JavaAgenticAIProfileandJavaSonarWayProfileto use static constants for profile names and paths.TestProfileRegistrarContextto support rule registration mapping for multiple distinct quality profiles.JavaAgenticWayProfileTestandJavaSonarWayProfileTestto ensure cross-profile isolation.This will update automatically on new commits.