Skip to content

Commit bcdae7f

Browse files
committed
Add end of file new line check
1 parent 84b553f commit bcdae7f

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

jenkins/check_eol.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fi
1515
ERRFILE=check_eol.sh.err
1616
rm -f $ERRFILE
1717

18-
git diff --name-only `git merge-base origin/master HEAD` HEAD | grep -v -E "(test/.*\\.js|\\.cmd|\\.baseline|\\.wasm|\\.vcxproj|\\.vcproj|\\.sln)" | xargs -I % ./jenkins/check_file_eol.sh %
18+
git diff --name-only `git merge-base origin/master HEAD` HEAD | grep -v -E "(test/.*\\.js|\\.cmd|\\.baseline|\\.wasm|\\.wast|\\.vcxproj|\\.vcproj|\\.sln)" | xargs -I % ./jenkins/check_file_eol.sh %
1919

2020
if [ -e $ERRFILE ]; then # if error file exists then there were errors
2121
>&2 echo "--------------" # leading >&2 means echo to stderr

jenkins/check_file_eol.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,10 @@ if [ $? -eq 0 ]; then # grep found matches ($?==0), so we found CR (0x0d) in the
3737
echo "--------------" >> $ERRFILE # same length as '--- ERRORS ---'
3838
fi
3939

40+
# Check that each file ends in a newline character
41+
tail -c1 $1 | od -x | grep '000a' > $ERRFILETEMP
42+
if [ $? -ne 0 ]; then # last character is not a newline
43+
echo "ERROR: $1 does not end in a new line" >> $ERRFILE
44+
fi
45+
4046
rm -f $ERRFILETEMP

0 commit comments

Comments
 (0)