New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
False-positive RightCurly in google_checks since 8.20 #6807
Comments
hmm, google style is precise on expected behavior, but our Check is not that configurable to allow this only by
I would recommend to try Xpath first and create new Check as last option. |
this issue caused used to disable Check completely in google config. |
@rnveach , do you remember why https://checkstyle.org/property_types.html#rcurly |
I do not know. |
it is not ok, as it should allow only empty braces |
Tree is like:
So we need to have Xpath that test that RCURLY is the only child of parent SLIST. |
Looks like I got it ....
@timurt , am I right in my xpath ? if so we can embed this filter in config so it will ease a problem. |
@romani , replying to your comment #6946 (comment): I checked few projects with the proposed suppression above. The only one violation was detected:
PS: don't ask me why that class is empty, I have no idea, just found it in one of the projects :) |
structure of AST is a bit different for empty classes:
|
Here is working example:
@rdiachenko , please try to put in your config filter, this version of filter, it should suppress most false positives, BUT it will cause false-negatives on cases like new Check with possible name as |
@romani thanks a lot for the suggestion. Works fine for me, none suspicious behavior was detected. |
@romani Your xpath fails for one case once we introduce comment aware checks into the configuration which brings up an issue with our xpath implementation.
|
#7531 is valid issue, we need to think about it. Xpath that I provided is still good for Google style as style does not allow any content in |
Workaround is merged. |
https://checkstyle.org/config_blocks.html#RightCurly
https://checkstyle.org/property_types.html#rcurly
I expected no warning because of section 4.1.3 Empty blocks: may be concise in Google Java Style Guide.
Problem exists since Checkstyle 8.20, with Checkstyle 8.19 there is no such warning.
Checkstyle 8.20
Checkstyle 8.19
Google config:
checkstyle/src/main/resources/google_checks.xml
Lines 91 to 97 in dbbc42c
https://checkstyle.org/config_blocks.html#RightCurly
https://checkstyle.org/property_types.html#rcurly
The text was updated successfully, but these errors were encountered: