-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Issue #18265: Added allowMultipleEmptyLinesInsideClassMembers property inside EmptyLineSeparator check in google_checks.xml #18311
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
base: master
Are you sure you want to change the base?
Conversation
406dae4 to
aca7eed
Compare
|
Github, generate report |
aca7eed to
2dd5828
Compare
Zopsss
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor:
| package com.google.checkstyle.test.chapter4formatting.rule461verticalwhitespace; //violation ''package' has more than 1 empty lines before' | ||
| package com.google.checkstyle.test.chapter4formatting.rule461verticalwhitespace; | ||
|
|
||
| // violation 2 lines above ''package' has more than 1 empty lines before.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert this, no changes required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| package com.google.checkstyle.test.chapter4formatting.rule461verticalwhitespace; | ||
|
|
||
| // violation above ''package' has more than 1 empty lines before.' | ||
|
|
||
| public class InputFormattedEmptyLineSeparator3 { | ||
| // violation above ''CLASS_DEF' has more than 1 empty lines before.' | ||
| // violation above 'Missing a Javadoc comment.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a formatted file, then why did it contained "more than 1 empty lines before" violations? The formatter should have removed the empty lines, am I missing something here? @Praveen7294
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
am I missing something here?
No, the google-java-format workflow only formats non-excluded files. For excluded files, it locates the original file and its corresponding formatted file and compares the size difference by counting characters after removing whitespace and comments.
The contributor added this file, but it was not formatted. The contributor duplicated the original file and only changed the file name to InputFormatted* to pass the workflow. I have already mentioned that PR in this PR description.
0b77b02 to
543b0be
Compare
543b0be to
951dac4
Compare
|
@Zopsss please review |
|
Github, generate report |
| public class InputEmptyLineSeparator3 { | ||
| // violation above ''CLASS_DEF' has more than 1 empty lines before.' | ||
| // violation above 'Missing a Javadoc comment.' | ||
| // violation 2 lines above ''CLASS_DEF' has more than 1 empty lines before.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should be:
// 2 violations above:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| * This file contains incorrect vertical whitespace inside class | ||
| * members and also between class members. | ||
| */ | ||
| public class InputCorrectEmptyLineInsideClassMembers { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add an example of constructor, enum interface, etc. The supported tokens are mentioned here: https://checkstyle.org/checks/whitespace/emptylineseparator.html#Example5-config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added examples of constructors, enums, and interfaces. However, this check does not detect multiple empty lines inside enums, so I created an issue regarding this #18437
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file name is InputCorrect* but it contains violations. Please change the input name to InputMultipleEmptyLineInsideClassMembers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
The check is not aware of comments: https://checkstyle-diff-reports.s3.us-east-2.amazonaws.com/951dac4_2025065820/reports/diff/Hbase/index.html#A39 |
|
@Praveen7294 sorry for the delay, i have reviewed the PR and Report. Also, please do not wait for maintainers to review reports. After pushing the changes, generate the report and always self review it so the bugs can be caught a lot earlier. |
951dac4 to
07cc18f
Compare
…rs property inside EmptyLineSeparator check in google_checks.xml
07cc18f to
f927976
Compare
There are multiple false-positive cases, so I created an issue regarding this #18438. |
yes, in docs mentioned as Attention: should we include trailing comments to check? |
No Problem.
Okay, I will take care of that from next time. |
|
@Zopsss , please finish review |
We cannot add false-positives to our style guide implementation. First we need to solve them. Unfortunately, until all false-positives are solved, we cannot proceed with this PR. |
Yes we should do that, it is causing unnecessary violations. Please open a new issue regarding this. @romani cc |
Once it approved, I will start working on that |
romani
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I am blocking this PR until we clarify my comment in issue.
Issue: #18265
From: https://google.github.io/styleguide/javaguide.html#s4.6.1-vertical-whitespace
Added a allowMultipleEmptyLinesInsideClassMembers property inside EmptyLineSeparator check.
Added test cases
testCorrectEmptyLineSeparatorInsideClassMembers()andtestIncorrectEmptyLineSeparatorInsideClassMembers()inVerticalWhitespaceTest.java.Added input files
InputCorrectEmptyLineInsideClassMembers.javaandInputIncorrectEmptyLineInsideClassMembers.javato rule461verticalwhitespace directory.From this PR Issue #17681: Fix multiple blank line separation #17950 ,
InputEmptyLineSeparator3.javaandInputFormattedEmptyLineSeparator3.javawere added to therule461verticalwhitespacedirectory but but they were not covered by any test cases. Therefore, added test casestestEmptyLineSeparatorBetweenClassMembers()andtestFormattedEmptyLineSeparatorBetweenClassMembers()toVerticalWhitespaceTest.java.Diff Regression config: https://gist.githubusercontent.com/Praveen7294/605a30d7c12d5fcc633316127e4db0be/raw/c0f9602b094f75a806a296569b5f70a6c3d5e471/base-config-emptyline.xml
Diff Regression patch config: https://gist.githubusercontent.com/Praveen7294/0c2bffd20db9d6c9696c2fce03de4407/raw/f89ddb1333c8bfe4b26e62ba9f3e4327567bfc4e/patch-config-emptyline.xml
Diff Regression projects: https://gist.githubusercontent.com/Praveen7294/a1626a4272b4be9d7a0dc8a9fbae5ffa/raw/22fada1af5a2880572d3e91848996d50427c1616/list-of-projects.properties