From 79fd078ae340da74dbc5111ad04e919d0951c5e9 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Thu, 3 Nov 2022 18:27:10 +0100 Subject: [PATCH] add check for line endings containing CR. --- .github/checks/Makefile | 7 +++++-- .github/checks/lineendings.sh | 18 ++++++++++++++++++ Contributing.md | 4 ++++ test/err/bug1890.c | 18 +++++++++--------- 4 files changed, 36 insertions(+), 11 deletions(-) create mode 100755 .github/checks/lineendings.sh diff --git a/.github/checks/Makefile b/.github/checks/Makefile index 18cc153d4..6519eb5b8 100644 --- a/.github/checks/Makefile +++ b/.github/checks/Makefile @@ -1,7 +1,10 @@ -.PHONY: checkstyle tabs lastline spaces noexec +.PHONY: checkstyle lineendings tabs lastline spaces noexec -checkstyle: tabs lastline spaces noexec +checkstyle: lineendings tabs lastline spaces noexec + +lineendings: lineendings.sh + @./lineendings.sh tabs: tabs.sh @./tabs.sh diff --git a/.github/checks/lineendings.sh b/.github/checks/lineendings.sh new file mode 100755 index 000000000..5b445522f --- /dev/null +++ b/.github/checks/lineendings.sh @@ -0,0 +1,18 @@ +#! /bin/bash +OLDCWD=`pwd` +SCRIPT_PATH=`dirname $0` +CHECK_PATH=. + +cd $SCRIPT_PATH/../../ + +FILES=`find $CHECK_PATH -type f \( -name \*.inc -o -name Makefile -o -name \*.cfg -o -name \*.\[chs\] -o -name \*.mac -o -name \*.asm -o -name \*.sgml \) -print | grep -v "libwrk/" | grep -v "testwrk/" | xargs grep -IUl $'\r'` + +cd $OLDCWD + +if [ x"$FILES"x != xx ]; then + echo "error: found CR in the following files:" >&2 + for n in $FILES; do + echo $n >&2 + done + exit -1 +fi diff --git a/Contributing.md b/Contributing.md index 3541979f6..e316b9c61 100644 --- a/Contributing.md +++ b/Contributing.md @@ -14,6 +14,10 @@ This document contains all kinds of information that you should know if you want ## All Sources +### Line endings + +All files must only contain Unix style 'LF' line endings. Please configure your editors accordingly. + ### TABs and spaces This is an ongoing controversial topic - everyone knows that. However, the following is how we do it :) diff --git a/test/err/bug1890.c b/test/err/bug1890.c index afe04f071..15d857cdb 100644 --- a/test/err/bug1890.c +++ b/test/err/bug1890.c @@ -1,9 +1,9 @@ -/* bug #1890 - Overflow in enumerator value is not detected */ - -#include -enum { a = ULONG_MAX, b } c = b; - -int main(void) -{ - return 0; -} +/* bug #1890 - Overflow in enumerator value is not detected */ + +#include +enum { a = ULONG_MAX, b } c = b; + +int main(void) +{ + return 0; +}