Skip to content

Commit 7cdc050

Browse files
committed
Test files in this repository for correct formatting during CI build
Build fails from: - Trailing whitespace - True tabs - No newline at end of file
1 parent dd203c1 commit 7cdc050

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

.travis.yml

+7
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ before_install:
4343
# Check for issues in the script
4444
- bash -c 'shopt -s globstar; shellcheck arduino-ci-script.sh'
4545

46+
# Check for trailing whitespace in all files in the repository
47+
- "if grep --line-number --recursive --exclude-dir=.git '[[:blank:]]$' .; then echo 'Trailing whitespace found.'; false; fi"
48+
# Check for tabs in all files in the repository
49+
- "if grep --line-number --recursive --exclude-dir=.git $'\t' .; then echo 'Tab found.'; false; fi"
50+
# Check if all files in the repository end in a newline (https://stackoverflow.com/a/25686825)
51+
- find . -path ./.git -prune -o -type f -print0 | xargs -0 -L1 bash -c 'if test "$(tail --bytes=1 "$0")"; then echo "No new line at end of $0"; false; fi'
52+
4653
- source "${TRAVIS_BUILD_DIR}/arduino-ci-script.sh"
4754

4855
- set_script_verbosity "$VERBOSITY_LEVEL"

0 commit comments

Comments
 (0)