Issue #18926: Re-enable 'EmptyClass' inspection#19029
Conversation
8a83f60 to
b9c97c0
Compare
|
@romani
IntelliJ/Qodana evaluates the injected {@snippet} tag as a standalone file, which triggers the EmptyClass error. Since standard @SuppressWarnings is blocked by Checkstyle, and @noinspection is ignored by Qodana's isolated snippet parser, what is the preferred way to suppress this false positive? |
| * }</pre> | ||
| * | ||
| * @noinspection EmptyClass | ||
| * @noinspectionreason EmptyClass - false positive from Language Injection in snippet block |
There was a problem hiding this comment.
Try to add to allowed suppressions for idea
checkstyle/config/intellij-idea-inspections.xml
Line 4436 in bdbc3c9
There was a problem hiding this comment.
Suppression on field is not working.
Try to put suppression javadoc tags to class, not a field.
Please reproduce this problem in Idea on your local and ask Idea to suppress by annotation, and add javadoc tags to same element.
There was a problem hiding this comment.
I opened the file in IntelliJ IDEA locally and reproduced the false positive — the {@snippet} injected block inside the COLON field javadoc is flagged as EmptyClass due to Language Injection. IntelliJ's "Suppress for class" quick-fix generated @SuppressWarnings("EmptyClass") and the matching @noinspection javadoc tags on the class element. However, IntelliJ's auto-formatter kept introducing formatting violations against checkstyle's strict rules, so I applied the changes manually in VS Code, mirroring exactly what IntelliJ's quick-fix produced. Also added EmptyClass to myAllowedSuppressions in intellij-idea-inspections.xml.
5ff12bc to
e73e2f4
Compare
|
https://checkstyle.org/idea.html#Inspections Please reproduce it on local. |
d4f7cbf to
1924410
Compare
|
We need green CI to merge, only circleci failure is known instability . https://ci.appveyor.com/project/Checkstyle/checkstyle/builds/53603210/job/5l406iy3qwa512sn#L100
|
a44749c to
eb596fd
Compare
There was a problem hiding this comment.
Pull request overview
This PR re-enables the EmptyClass inspection in Qodana (issue #18926) by updating the IntelliJ IDEA inspection configuration and suppressing the inspection on a class that triggers a false positive.
Changes:
- Re-enables the
EmptyClass(andJava9ReflectionClassVisibility) inspection in the IntelliJ IDEA inspections config. - Adds
EmptyClassto a suppression list for a specific inspection tool in the config. - Suppresses the
EmptyClassinspection onJavadocCommentsTokenTypes.javawith a documented reason.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
config/intellij-idea-inspections.xml |
Re-enables EmptyClass and Java9ReflectionClassVisibility inspections; adds EmptyClass to an exclusion list for a specific tool |
src/main/java/com/puppycrawl/tools/checkstyle/api/JavadocCommentsTokenTypes.java |
Suppresses the EmptyClass inspection on the class with a false-positive reason |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -1682,7 +1682,7 @@ | |||
| <inspection_tool class="EmptyCatchBlockJS" enabled="true" level="ERROR" | |||
| enabled_by_default="true"/> | |||
| <!-- temporary disabled until https://github.com/checkstyle/checkstyle/issues/18926 --> | |||
There was a problem hiding this comment.
The comment on line 1684 ("temporary disabled until ...") was not removed when the inspection was re-enabled. Since this inspection is now enabled and the issue is resolved, the stale comment should be removed.
| <!-- temporary disabled until https://github.com/checkstyle/checkstyle/issues/18926 --> |
0ec45a5 to
ff2a2e3
Compare
|
@romani , I am still working on fixing the remaining CI failures. Will update the PR once all checks are green. Thank you for your patience. I will ping u when it complete from my side |
|
@avadhutmali, this is last fix for this issue, please find time to fix it sooner |
8a8da07 to
47810b5
Compare
@romani , Ping |
| * javadoc - The Java API Documentation Generator</a> | ||
| * @noinspection JavadocDeclaration | ||
| * @noinspection JavadocDeclaration ,EmptyClass | ||
| * @noinspectionreason JavadocDeclaration - Javadoc is intentional |
There was a problem hiding this comment.
Please add new line for new noinspectionreason to explain reason we do suppression
47810b5 to
c0b6f6c
Compare
Fixes #18926
This PR re-enables the
EmptyClassinspection in Qodana.Note to reviewers: I am opening this PR as a draft initially to trigger the Qodana CI pipeline and filter the exact list of files violating this specific inspection. I will push the code fixes shortly once the CI provides the targeted report.