Skip to content

DO NOT MERGE - TEST PVF - #6312

Open
rombirli wants to merge 2 commits into
masterfrom
rombirli/test-pvf
Open

rombirli wants to merge 2 commits into
masterfrom
rombirli/test-pvf

Conversation

@rombirli

@rombirli rombirli commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary by Gitar

  • Rule updates:
    • Updated EmptyClassCheck to raise issues on every class regardless of whether it is empty or extends other classes.

This will update automatically on new commits.

@rombirli

rombirli commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

/pvf

@datadog-sonarsource

datadog-sonarsource Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Pipelines

❌ Errors

Your PR has failed checks. Please review the issues below and take necessary action before merging.

🚦 7 Pipeline jobs failed

Build | Build and Unit Test on Windows — 🔧 Needs a code fix, caused by this PR

View more details · View in GitHub Actions

Build | Plugin QA (LATEST_RELEASE, false) — 🔧 Needs a code fix, caused by this PR

View more details · View in GitHub Actions

Build | Ruling QA (warp-custom-ubuntu-24-04, only-sonarqube-project, LATEST_RELEASE) — 🔧 Needs a code fix, caused by this PR

View more details · View in GitHub Actions

View all 7 failed jobs.

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: d756385 | Docs | View more details | Give us feedback!

Comment on lines +39 to +40
if (simpleName!=null)
reportIssue(simpleName, "Remove this empty class, write its code or make it an \"interface\".");

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: S2094 now reports every named class/record, not just empty ones

The isNotExtending(classTree) && isEmpty(classTree) guard was removed. Now visitNode calls reportIssue for every CLASS and RECORD that has a name, so you'll get a false positive on every class with members, annotations, record components, a superclass or interfaces. The message "Remove this empty class..." is wrong for all of those. Existing expectations in EmptyClassCheck tests (the // Noncompliant markers on compliant classes) will fail, and analysis results across all projects will flood. To fix this, put the original condition back.

Restore the emptiness/non-extending guard:

if (simpleName != null && isNotExtending(classTree) && isEmpty(classTree)) {
  reportIssue(simpleName, "Remove this empty class, write its code or make it an "interface".");
}
  • 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 Oct 8, 2026 •

Copy link
Copy Markdown
CI failed: Test failures occurred in the ruling and checks modules due to assertion mismatches and test errors from updated rule behavior.

Overview

Two unique failure patterns were found across 6 logs, consisting of test failures in the ruling and java-checks modules related to rule S2094 changes.

Failures

Java Ruling Test Mismatch (confidence: high)

  • Type: test
  • Affected jobs: 113391517816
  • Related to change: yes
  • Root cause: The ruling test failed because it reported 1,346 issue differences from the expected baseline. The PR explicitly changes rule S2094 to raise on every class, causing a discrepancy with the existing ruling baseline.
  • Suggested fix: Review the generated ruling differences to confirm they are the intended S2094 findings, then update the corresponding expected ruling data.

Java Checks Test Failures (confidence: medium)

  • Type: test
  • Affected jobs: 113391517729, 113391517831
  • Related to change: unclear
  • Root cause: Surefire reported test failures in the java-checks module, though the exact test failures are omitted from the main log excerpt.
  • Suggested fix: Inspect the java-checks/target/surefire-reports files to identify the failing tests and adjust them according to the intended rule changes.

Summary

  • Change-related failures: 1 ruling test failure caused by expected baseline discrepancies from the S2094 rule change.
  • Infrastructure/flaky failures: 0 infrastructure or flaky failures.
  • Recommended action: Review the surefire reports for java-checks and update expected ruling files for JavaRulingTest to align with the new S2094 behavior.
Code Review 🚫 Blocked 0 closed / 1 findings

🟡 Medium risk · Removing the emptiness and inheritance checks makes S2094 flag every class, potentially producing widespread false positives and obscuring valid findings.

Removes the guard conditions from EmptyClassCheck to report on every class, but this produces false positives on all non-empty classes, records with components, and classes with superclasses or interfaces. The original isNotExtending and isEmpty checks must be restored to fix the issue; alternatively, the now-unused helper methods should be deleted.

🚨 Bug: S2094 now reports every named class/record, not just empty ones

📄 java-checks/src/main/java/org/sonar/java/checks/EmptyClassCheck.java:39-40 📄 java-checks/src/main/java/org/sonar/java/checks/EmptyClassCheck.java:43-51

The isNotExtending(classTree) && isEmpty(classTree) guard was removed. Now visitNode calls reportIssue for every CLASS and RECORD that has a name, so you'll get a false positive on every class with members, annotations, record components, a superclass or interfaces. The message "Remove this empty class..." is wrong for all of those. Existing expectations in EmptyClassCheck tests (the // Noncompliant markers on compliant classes) will fail, and analysis results across all projects will flood. To fix this, put the original condition back.

Restore the emptiness/non-extending guard
if (simpleName != null && isNotExtending(classTree) && isEmpty(classTree)) {
  reportIssue(simpleName, "Remove this empty class, write its code or make it an "interface".");
}
🤖 Prompt for agents
Code Review: Removes the guard conditions from `EmptyClassCheck` to report on every class, but this produces false positives on all non-empty classes, records with components, and classes with superclasses or interfaces. The original `isNotExtending` and `isEmpty` checks must be restored to fix the issue; alternatively, the now-unused helper methods should be deleted.

1. 🚨 Bug: S2094 now reports every named class/record, not just empty ones
   Files: java-checks/src/main/java/org/sonar/java/checks/EmptyClassCheck.java:39-40, java-checks/src/main/java/org/sonar/java/checks/EmptyClassCheck.java:43-51

   The `isNotExtending(classTree) && isEmpty(classTree)` guard was removed. Now `visitNode` calls `reportIssue` for every CLASS and RECORD that has a name, so you'll get a false positive on every class with members, annotations, record components, a superclass or interfaces. The message "Remove this empty class..." is wrong for all of those. Existing expectations in EmptyClassCheck tests (the `// Noncompliant` markers on compliant classes) will fail, and analysis results across all projects will flood. To fix this, put the original condition back.

   Fix (Restore the emptiness/non-extending guard):
   if (simpleName != null && isNotExtending(classTree) && isEmpty(classTree)) {
     reportIssue(simpleName, "Remove this empty class, write its code or make it an "interface".");
   }

Review coverage

🧪 Functional validation No results

📋 Rules No rules evaluated

Cross-repo coverage 5 repositories selected

Cross-repo inspection is incomplete. Unread code may contain additional impacts.

🤖 Auto-approval Not enabled · Set up

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 → Counting what did not apply, without listing it.
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

@gitar-bot gitar-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ This PR is blocked due to unresolved code review findings.

Comment gitar unblock to override this block and allow merging.

Configure merge blocking · Maintainers can dismiss this review.

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

⚖️ Ruling update ready for review: #6313

@hashicorp-vault-sonar-prod

Copy link
Copy Markdown
Contributor

📊 Performance Validation complete
🆕 65604 new · 🗑️ 0 lost issues
View dashboard

This branch has not been deployed

No deployments
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