RC-350 Unify ruling expectation file locations. by romainbrenguier · Pull Request #827 · SonarSource/sonar-html · GitHub
Skip to content

RC-350 Unify ruling expectation file locations. - #827

Draft
romainbrenguier wants to merge 1 commit into
masterfrom
romain/normalize-ruling-expectations
Draft

romainbrenguier wants to merge 1 commit into
masterfrom
romain/normalize-ruling-expectations

Conversation

@romainbrenguier

Copy link
Copy Markdown

Summary

  • Move all 76 ruling expectation JSON files from its/ruling/src/test/resources/expected/ to its/ruling/src/test/resources/expected/web/project/
  • Update WebRulingTest.java to reference the new path
  • Normalize ruling expectation file locations so that it is consistent across all analyzers

Test plan

  • Verify ruling integration tests pass with the new file layout

🤖 Generated with Claude Code

Move ruling expectation files from expected/ to expected/web/project/
to follow the consistent expected/<language>/<project-key>/<rule-id>.json
convention used across analyzers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@romainbrenguier
romainbrenguier requested a review from a team September 9, 2026 10:46
@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Sep 9, 2026

Copy link
Copy Markdown

.setProperty("sonar.html.file.suffixes", "xhtml,html,php,erb")
.setProperty("sonar.jsp.file.suffixes", "jspf,jsp")
.setProperty("sonar.lits.dump.old", FileLocation.of("src/test/resources/expected").getFile().getAbsolutePath())
.setProperty("sonar.lits.dump.old", FileLocation.of("src/test/resources/expected/web/project").getFile().getAbsolutePath())

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Bug: CI ruling auto-update still copies into old flat expected/ dir

The ruling auto-update step copies its/ruling/target/actual/* (a flat set of Web-*.json files produced by sonar.lits.dump.new) into its/ruling/src/test/resources/expected/, which was the correct target only while the expectations lived flat in that directory. After this PR the test reads expectations from expected/web/project, so on a ruling failure the workflow will commit 76 stale duplicate JSON files at the old root path and never update the files the test actually compares against — the auto-update becomes a no-op that pollutes the PR and the ruling test keeps failing. Point the copy at the new directory (the git add its/ruling/src/test/resources/expected/ line still covers the subdirectory).

Copy the LITS dump into the new expected/web/project directory:

cp -r its/ruling/target/actual/* its/ruling/src/test/resources/expected/web/project/
  • Apply fix

Check the box to apply the fix or reply for a change | Was this helpful? React with 👍 / 👎

@gitar-bot

gitar-bot Bot commented Sep 9, 2026

Copy link
Copy Markdown
CI failed: The CI build failed because the generated ruling report comment exceeded the GitHub GraphQL API comment length limit of 65,536 characters.

Overview

1 log analyzed showing a failure during the GitHub comment creation step due to payload size limits being exceeded.

Failures

GitHub Comment Body Too Long (confidence: high)

  • Type: other
  • Affected jobs: 102435619958
  • Related to change: yes
  • Root cause: The generated PR comment containing the ruling report and diffs exceeded the maximum length of 65536 characters allowed by the GitHub GraphQL API.
  • Suggested fix: Truncate or summarize the ruling report comment contents in the workflow script to ensure it remains below the character limit.

Summary

  • Change-related failures: 1 failure due to excessive ruling report comment size
  • Infrastructure/flaky failures: 0
  • Recommended action: Update the workflow script that generates the ruling report comment to truncate or summarize long output before posting it to the PR.
Code Review ⚠️ Changes requested 0 resolved / 1 findings

Unifies ruling expectation file locations by moving 76 JSON files from its/ruling/src/test/resources/expected/ to its/ruling/src/test/resources/expected/web/project/. The CI ruling auto-update workflow still copies into the old flat expected/ directory, so on test failures it will commit stale duplicates and never update the files the test actually compares against — update the copy target in WebRulingTest.java:91 to point to the new directory.

⚠️ Bug: CI ruling auto-update still copies into old flat expected/ dir

📄 its/ruling/src/test/java/org/sonar/web/it/WebRulingTest.java:91

The ruling auto-update step copies its/ruling/target/actual/* (a flat set of Web-*.json files produced by sonar.lits.dump.new) into its/ruling/src/test/resources/expected/, which was the correct target only while the expectations lived flat in that directory. After this PR the test reads expectations from expected/web/project, so on a ruling failure the workflow will commit 76 stale duplicate JSON files at the old root path and never update the files the test actually compares against — the auto-update becomes a no-op that pollutes the PR and the ruling test keeps failing. Point the copy at the new directory (the git add its/ruling/src/test/resources/expected/ line still covers the subdirectory).

Copy the LITS dump into the new expected/web/project directory
cp -r its/ruling/target/actual/* its/ruling/src/test/resources/expected/web/project/
🤖 Prompt for agents
Code Review: Unifies ruling expectation file locations by moving 76 JSON files from `its/ruling/src/test/resources/expected/` to `its/ruling/src/test/resources/expected/web/project/`. The CI ruling auto-update workflow still copies into the old flat `expected/` directory, so on test failures it will commit stale duplicates and never update the files the test actually compares against — update the copy target in `WebRulingTest.java:91` to point to the new directory.

1. ⚠️ Bug: CI ruling auto-update still copies into old flat expected/ dir
   Files: its/ruling/src/test/java/org/sonar/web/it/WebRulingTest.java:91

   The ruling auto-update step copies `its/ruling/target/actual/*` (a flat set of `Web-*.json` files produced by `sonar.lits.dump.new`) into `its/ruling/src/test/resources/expected/`, which was the correct target only while the expectations lived flat in that directory. After this PR the test reads expectations from `expected/web/project`, so on a ruling failure the workflow will commit 76 stale duplicate JSON files at the old root path and never update the files the test actually compares against — the auto-update becomes a no-op that pollutes the PR and the ruling test keeps failing. Point the copy at the new directory (the `git add its/ruling/src/test/resources/expected/` line still covers the subdirectory).

   Fix (Copy the LITS dump into the new expected/web/project directory):
   cp -r its/ruling/target/actual/* its/ruling/src/test/resources/expected/web/project/

Tip

Comment Gitar fix CI or enable auto-apply: gitar auto-apply:on

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.
Unblock → Override a blocking verdict and allow merging.

Comment with these commands to change the behavior for this request:

Auto-apply Compact Unblock
gitar auto-apply:on         
gitar display:verbose         
gitar unblock         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqube-next

sonarqube-next Bot commented Sep 9, 2026

Copy link
Copy Markdown

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
0 Dependency risks
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@datadog-sonarsource

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant