Repository navigation
Conversation
|
/pvf |
❌ ErrorsYour PR has failed checks. Please review the issues below and take necessary action before merging. 🚦 7 Pipeline jobs failed
Useful? React with 👍 / 👎 This comment will be updated automatically if new data arrives.🔗 Commit SHA: d756385 | Docs | View more details | Give us feedback! |
| if (simpleName!=null) | ||
| reportIssue(simpleName, "Remove this empty class, write its code or make it an \"interface\"."); |
There was a problem hiding this comment.
🚨 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 👍 / 👎
CI failed: Test failures occurred in the ruling and checks modules due to assertion mismatches and test errors from updated rule behavior.OverviewTwo unique failure patterns were found across 6 logs, consisting of test failures in the ruling and java-checks modules related to rule S2094 changes. FailuresJava Ruling Test Mismatch (confidence: high)
Java Checks Test Failures (confidence: medium)
Summary
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 🚨 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 Restore the emptiness/non-extending guard🤖 Prompt for agentsReview 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 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 |
There was a problem hiding this comment.
Comment gitar unblock to override this block and allow merging.
Configure merge blocking · Maintainers can dismiss this review.
|
⚖️ Ruling update ready for review: #6313 |
|
📊 Performance Validation complete |
Summary by Gitar
EmptyClassCheckto raise issues on every class regardless of whether it is empty or extends other classes.This will update automatically on new commits.