Skip to content

RC-350 Unify ruling expectation file locations - #1803

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

RC-350 Unify ruling expectation file locations#1803
romainbrenguier wants to merge 1 commit into
masterfrom
romain/normalize-ruling-expectations

Conversation

@romainbrenguier

Copy link
Copy Markdown

Summary

  • Normalize ruling expectation file locations so that it is consistent across all analyzers.
  • Move expectation files from its/ruling/src/integrationTest/resources/expected/<project>/ to its/ruling/src/test/resources/expected/php/<project>/<rule-id>.json
  • Update RulingHelper, PhpGeneralRulingTest, and PhpPrAnalysisTest to reference the new paths

Test plan

  • Verify ruling integration tests pass with the new file locations

🤖 Generated with Claude Code

Move ruling expectation files from
its/ruling/src/integrationTest/resources/expected/<project>/
to its/ruling/src/test/resources/expected/php/<project>/
so that the file layout is consistent across all analyzers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@hashicorp-vault-sonar-prod

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

Copy link
Copy Markdown
Contributor

RC-350

Comment on lines +64 to 65
.setProperty("sonar.lits.dump.old", FileLocation.of("src/test/resources/" + expectedIssueLocation).getFile().getAbsolutePath())
.setProperty("sonar.lits.dump.new", FileLocation.of("build/actual").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.

💡 Quality: README ruling procedure points at the pre-move expected path

The README's "Ruling Test" instructions tell developers to copy actual issues into sonar-php/its/ruling/src/test/resources/expected/, but after this PR the expectation files live one level deeper, under expected/php/<project>/. A developer following the documented procedure would create a second expected/<project>/ tree that no test reads, and the ruling test would keep failing. While updating this block, the source directory is also stale: RulingHelper sets sonar.lits.dump.new to build/actual (Gradle), not target/actual (Maven).

Update the README ruling instructions to the Gradle output dir and the new expected layout:

If everything looks good to you, you can copy the file with the actual issues located at
```
sonar-php/its/ruling/build/actual/
```
into the directory with the expected issues
```
sonar-php/its/ruling/src/test/resources/expected/php/<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: 1 infrastructure failure due to a temporary HTTP 503 Service Unavailable error when fetching scanner-engine metadata during the SonarQube analysis task.

Overview

One log was analyzed, revealing a transient external service failure during the SonarQube analysis step.

Failures

SonarQube Scanner Engine Metadata HTTP 503 Failure (confidence: high)

  • Type: infrastructure
  • Affected jobs: 102425902889
  • Related to change: no
  • Root cause: The Gradle task ':sonar' failed to retrieve the scanner-engine metadata due to an HTTP 503 Service Unavailable response from the SonarQube server.
  • Suggested fix: Rerun the CI workflow to bypass the transient service unavailability.

Summary

  • Change-related failures: 0
  • Infrastructure/flaky failures: 1 (Transient HTTP 503 Service Unavailable error from the SonarQube server API endpoint)
  • Recommended action: Rerun the CI job.
Code Review 👍 Approved with suggestions 0 resolved / 1 findings

Refactors ruling expectation file locations to normalize paths across analyzers, moving files from its/ruling/src/integrationTest/resources/expected/<project>/ to its/ruling/src/test/resources/expected/php/<project>/<rule-id>.json and updating test helpers accordingly. Update the README ruling procedure documentation to reflect the new nested directory structure and correct the stale Maven/Gradle build output paths.

💡 Quality: README ruling procedure points at the pre-move expected path

📄 its/ruling/src/integrationTest/java/org/sonar/php/it/RulingHelper.java:64-65

The README's "Ruling Test" instructions tell developers to copy actual issues into sonar-php/its/ruling/src/test/resources/expected/, but after this PR the expectation files live one level deeper, under expected/php/<project>/. A developer following the documented procedure would create a second expected/<project>/ tree that no test reads, and the ruling test would keep failing. While updating this block, the source directory is also stale: RulingHelper sets sonar.lits.dump.new to build/actual (Gradle), not target/actual (Maven).

Update the README ruling instructions to the Gradle output dir and the new expected layout
If everything looks good to you, you can copy the file with the actual issues located at
```
sonar-php/its/ruling/build/actual/
```
into the directory with the expected issues
```
sonar-php/its/ruling/src/test/resources/expected/php/<project>/
```
🤖 Prompt for agents
Code Review: Refactors ruling expectation file locations to normalize paths across analyzers, moving files from `its/ruling/src/integrationTest/resources/expected/<project>/` to `its/ruling/src/test/resources/expected/php/<project>/<rule-id>.json` and updating test helpers accordingly. Update the README ruling procedure documentation to reflect the new nested directory structure and correct the stale Maven/Gradle build output paths.

1. 💡 Quality: README ruling procedure points at the pre-move expected path
   Files: its/ruling/src/integrationTest/java/org/sonar/php/it/RulingHelper.java:64-65

   The README's "Ruling Test" instructions tell developers to copy actual issues into `sonar-php/its/ruling/src/test/resources/expected/`, but after this PR the expectation files live one level deeper, under `expected/php/<project>/`. A developer following the documented procedure would create a second `expected/<project>/` tree that no test reads, and the ruling test would keep failing. While updating this block, the source directory is also stale: `RulingHelper` sets `sonar.lits.dump.new` to `build/actual` (Gradle), not `target/actual` (Maven).

   Fix (Update the README ruling instructions to the Gradle output dir and the new expected layout):
   If everything looks good to you, you can copy the file with the actual issues located at
   ```
   sonar-php/its/ruling/build/actual/
   ```
   into the directory with the expected issues
   ```
   sonar-php/its/ruling/src/test/resources/expected/php/<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.

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

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

Was this helpful? React with 👍 / 👎 | Gitar

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