-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
EmptyLineSeparator: Inability to use xpath for violation on empty line #8179
Comments
it is not critical on what node to print violation as in java you always have some character after - end of class scope. It would be good to report on previous token always, as we always know it existed and we do NOT know what will be on next line, this will be more reliable approach I think. |
@romani it' ok to move violation report on previous token, right? If yes, I will plan to solve this issue. |
Right. You are welcome to send PR |
I am on it. |
…LineSeparator Check
…LineSeparator Check
…LineSeparator Check
…LineSeparator Check
…LineSeparator Check
…LineSeparator Check
…LineSeparator Check
…LineSeparator Check
…LineSeparator Check
…LineSeparator Check
…LineSeparator Check
…LineSeparator Check
…LineSeparator Check
…LineSeparator Check
…LineSeparator Check
…LineSeparator Check
…LineSeparator Check
…LineSeparator Check
…LineSeparator Check
…LineSeparator Check
…LineSeparator Check
merged |
Shouldn't the warning be removed from the documentation? https://checkstyle.org/checks/whitespace/emptylineseparator.html#EmptyLineSeparator |
Split from #7956
checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck.java
Line 419 in a8a90cf
There is no AST node associated an empty line for which the violations are logged. This results the inability of such violations to be xpath suppressed. We may need to change the violation a bit to make it compliant with xpath.
In the above example it is clear that when we have to log violation for a similar case, outside the class members, we do it in a single go.
Test.java:5: 'METHOD_DEF' has more than 1 empty lines before. [EmptyLineSeparator]
This can be extended to solve this issue as well, where instead of logging for every empty line, we can log violation for the above example as follows:
Test.java:9: There is more than 1 empty line above. [EmptyLineSeparator]
However, the node to be logged is a bit uncertain. This needs to be dicussed.
The text was updated successfully, but these errors were encountered: