-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
I have read check documentation: https://checkstyle.sourceforge.io/checks/misc/newlineatendoffile.html#NewlineAtEndOfFile
I have downloaded the latest checkstyle from: https://checkstyle.org/cmdline.html#Download_and_Run
I have executed the cli and showed it below, as cli describes the problem better than 1,000 words
/var/tmp $ cat config.xml
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="NewlineAtEndOfFile"/>
</module>
/var/tmp $ RUN_LOCALE="-Duser.language=en -Duser.country=US"
/var/tmp $ java $RUN_LOCALE -jar checkstyle-10.25.0-all.jar -c config.xml \
checkstyle/src/test/resources/com/puppycrawl/tools/checkstyle/checks/newlineatendoffile/InputNewlineAtEndOfFileEmptyFile.txt
Starting audit...
[ERROR] InputNewlineAtEndOfFileEmptyFile.txt:1: File does not end with a newline. [NewlineAtEndOfFile]
Audit done.
Checkstyle ends with 1 errors.
NewlineAtEndOfFile
is reporting files with size 0 as errors.
The current workaround is to add a single line separator to the file.
Is it possible to revert this decision?
Input file was added just for test coverage, https://github.com/checkstyle/checkstyle/commits/f1efb27670a93690577f1bae17fc9dcbd88a795d/src/testinputs/com/puppycrawl/tools/checkstyle/InputEmptyFile.txt?browsing_rename_history=true&new_path=src/test/resources/com/puppycrawl/tools/checkstyle/checks/newlineatendoffile/InputNewlineAtEndOfFileEmptyFile.txt&original_branch=master not a user request.