Using portable CheckStyle check for a new line at the end of files

This commit is contained in:
Gunnar Morling 2014-01-10 22:31:32 +01:00
parent 217562d52b
commit 644702eed9

View File

@ -1,4 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE module PUBLIC <!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN" "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd"> "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
@ -22,10 +23,6 @@
</module> </module>
--> -->
<!-- Checks whether files end with a new line. -->
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
<module name="NewlineAtEndOfFile"/>
<!-- Checks that property files contain the same keys. --> <!-- Checks that property files contain the same keys. -->
<!-- See http://checkstyle.sf.net/config_misc.html#Translation --> <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
<module name="Translation"/> <module name="Translation"/>
@ -39,10 +36,20 @@
<property name="eachLine" value="true"/> <property name="eachLine" value="true"/>
</module> </module>
<!-- Not using NewLineAtEndOfFile as it doesn't work across all platforms
in conjunction with git's automatic handling of line endings. This rule fails
if there is a non-whitespace character at the end of the file; Together with
the next rule which forbids trailing whitespace characters this enforces a
new line at the end of the file -->
<module name="RegexpMultiline">
<property name="format" value="\S\z" />
<property name="message" value="There is no new line at the end of file" />
</module>
<module name="RegexpSingleline"> <module name="RegexpSingleline">
<!-- \s matches whitespace character, $ matches end of line. --> <!-- \s matches whitespace character, $ matches end of line. -->
<property name="format" value="\s+$"/> <property name="format" value="\s+$"/>
<property name="message" value="Line has trailing spaces."/> <property name="message" value="Line has trailing spaces"/>
</module> </module>
<module name="TreeWalker"> <module name="TreeWalker">