check_whitespace: Add script to run whitespace checks

Allow users to run the "travis ci" whitespace check directly from the
command-line.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-06-23 17:44:48 -04:00
parent a2c7fd369c
commit 4bb0b6defd
2 changed files with 16 additions and 7 deletions

15
scripts/check_whitespace.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
# Script to check whitespace in Klipper source code.
# Find SRCDIR from the pathname of this script
SRCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. && pwd )"
cd ${SRCDIR}
# Run whitespace tool on all source files
WS_DIRS="config/ docs/ klippy/ scripts/ src/ test/"
WS_EXCLUDE="-path scripts/kconfig -prune"
WS_FILES="-o -iname '*.[csh]' -o -name '*.py' -o -name '*.sh'"
WS_FILES="$WS_FILES -o -name '*.md' -o -name '*.cfg'"
WS_FILES="$WS_FILES -o -name '*.test' -o -name '*.config'"
WS_FILES="$WS_FILES -o -iname '*.lds' -o -iname 'Makefile' -o -iname 'Kconfig'"
eval find $WS_DIRS $WS_EXCLUDE $WS_FILES | xargs ./scripts/check_whitespace.py

View File

@ -35,14 +35,8 @@ finish_test()
# Check for whitespace errors # Check for whitespace errors
###################################################################### ######################################################################
WS_DIRS="config/ docs/ klippy/ scripts/ src/ test/"
WS_EXCLUDE="-path scripts/kconfig -prune"
WS_FILES="-o -iname '*.[csh]' -o -name '*.py' -o -name '*.sh'"
WS_FILES="$WS_FILES -o -name '*.md' -o -name '*.cfg'"
WS_FILES="$WS_FILES -o -name '*.test' -o -name '*.config'"
WS_FILES="$WS_FILES -o -iname '*.lds' -o -iname 'Makefile' -o -iname 'Kconfig'"
start_test check_whitespace "Check whitespace" start_test check_whitespace "Check whitespace"
eval find $WS_DIRS $WS_EXCLUDE $WS_FILES | xargs ./scripts/check_whitespace.py ./scripts/check_whitespace.sh
finish_test check_whitespace "Check whitespace" finish_test check_whitespace "Check whitespace"