Skip to content

Conversation

@Anmol202005
Copy link
Collaborator

Fixes: #124

Implemented recipe for NewlineAtEndOfFile: https://checkstyle.sourceforge.io/checks/misc/newlineatendoffile.html

@Anmol202005 Anmol202005 force-pushed the eol branch 15 times, most recently from 8b311bc to e5cc5a3 Compare October 30, 2025 19:29
@Anmol202005
Copy link
Collaborator Author

Finally got CI GREEN.

@rdiachenko pls review :)

@Anmol202005
Copy link
Collaborator Author

@romani @rdiachenko ping.

Copy link
Member

@romani romani left a 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:

final Space eof = sourceFile.getEof();
final String lastWhitespace = eof.getLastWhitespace();

if (!lineEnding.equals(lastWhitespace)) {
Copy link
Member

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.

Copy link
Collaborator Author

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.

Copy link
Member

@romani romani left a 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));
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement recipe for NewlineAtEndOfFile

2 participants