SONARJAVA-6524 Generate built-in profiles from rule metadata#5705
SONARJAVA-6524 Generate built-in profiles from rule metadata#5705romainbrenguier wants to merge 3 commits into
Conversation
c0ca171 to
f826968
Compare
6c724fb to
4ebb9c8
Compare
|
Thanks for the comprehensive review. I've addressed both remaining suggestions:
Both changes improve the build configuration clarity and help prevent silent profile-membership mistakes. |
12e4ea6 to
525fdec
Compare
5a5b0c2 to
75bdcae
Compare
Code Review ✅ Approved 8 resolved / 8 findingsAutomates profile JSON generation from rule metadata during the build and removes tracked source files, resolving seven reliability and configuration issues including stale references and fragile parsing logic. No issues remain. ✅ 8 resolved✅ Quality: Profile generator silently drops rules with unknown profile names
✅ Quality: Regex-based JSON parsing in ProfileJsonGenerator is fragile
✅ Bug: Stale source profile JSONs collide with generated ones
✅ Edge Case: numericKey throws cryptic NumberFormatException on stray files
✅ Bug: MetadataTest reads deleted src/main/resources profile JSON
...and 3 more resolved from earlier reviews 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 |
Replace metadata-based profile generation with directory-based approach. Each rule's profile membership is now represented by a file in profile-specific directories (profiles/sonar_way/, profiles/sonar_agentic_ai/). This eliminates merge conflicts when parallel PRs add rules to profiles, as each PR creates a new file instead of editing a shared JSON array. Changes: - Add ProfileJsonGenerator to scan profile directories and generate JSONs - Create profile directories with 534 (Sonar way) and 467 (Agentic AI) rule files - Update pom.xml to generate and copy profiles during build - Add README.md with usage instructions
These files are now generated during the Maven build from the profile directories (sonar_way/ and sonar_agentic_ai/), so they should not be tracked in git. The generated files are placed in target/classes/ during the build. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
75bdcae to
eb7de0f
Compare
Code Review ✅ Approved 8 resolved / 8 findingsAutomates the generation of built-in profile JSON files from rule metadata and removes source-controlled JSONs, resolving issues related to stale files, fragile parsing, and incorrect rule-key handling. ✅ 8 resolved✅ Quality: Profile generator silently drops rules with unknown profile names
✅ Quality: Regex-based JSON parsing in ProfileJsonGenerator is fragile
✅ Bug: Stale source profile JSONs collide with generated ones
✅ Edge Case: numericKey throws cryptic NumberFormatException on stray files
✅ Bug: MetadataTest reads deleted src/main/resources profile JSON
...and 3 more resolved from earlier reviews 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
Testing
Summary by Gitar
ProfileJsonGenerator.javato automate the creation of profile JSON files during the build process.pom.xmlto include generated resource directories and configuredexec-maven-pluginto execute the generator.sonarpedia.jsonto include theprofiles-pathconfiguration.README.mdinsrc/main/resources/profiles/detailing the new rule management and build process.JavaAgenticWayProfileTestto reflect the change in the total count of active rules from465to466.MetadataTestto point to the generated profile resources intarget/classes/.This will update automatically on new commits.