-
Notifications
You must be signed in to change notification settings - Fork 6
Issue #124: Implement recipe for NewlineAtEndOfFile #125
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: main
Are you sure you want to change the base?
Conversation
8b311bc to
e5cc5a3
Compare
|
Finally got CI GREEN. @rdiachenko pls review :) |
|
@romani @rdiachenko ping. |
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 for delay ...
items:
src/main/java/org/checkstyle/autofix/recipe/NewlineAtEndOfFile.java
Outdated
Show resolved
Hide resolved
src/main/java/org/checkstyle/autofix/recipe/NewlineAtEndOfFile.java
Outdated
Show resolved
Hide resolved
src/main/java/org/checkstyle/autofix/recipe/NewlineAtEndOfFile.java
Outdated
Show resolved
Hide resolved
| final Space eof = sourceFile.getEof(); | ||
| final String lastWhitespace = eof.getLastWhitespace(); | ||
|
|
||
| if (!lineEnding.equals(lastWhitespace)) { |
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.
we do not trust checkstyle violation ? or it is save check in case of second execution.
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 check for second execution.
src/main/java/org/checkstyle/autofix/recipe/NewlineAtEndOfFile.java
Outdated
Show resolved
Hide resolved
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.
last:
| if (!expectedLineEnding.equals(lastWhitespace)) { | ||
| final List<Comment> comments = eof.getComments(); | ||
| if (comments.isEmpty()) { | ||
| result = sourceFile.withEof(Space.format(expectedLineEnding)); |
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.
does it check comments at the end of file ?
if yes, we do not have test input for this, please add.
if no, please share details with me, I need you help here.
Fixes: #124
Implemented recipe for NewlineAtEndOfFile: https://checkstyle.sourceforge.io/checks/misc/newlineatendoffile.html