airshipui/tools/whitespace_linter
Schiefelbein, Andrew cb9fa2624a Incorporate the whitespace linter from the CTL project
This just brings over the whitespace linter and updates any
files that may have been out of compliance.  It's also a small
update to .gitignore to not care about the .out files generated
by a make cover command.

Change-Id: I3e5a4f170f0fd7724949708a290a1e13def834fb
2020-07-22 13:40:32 -05:00

12 lines
434 B
Bash
Executable File

#!/usr/bin/env bash
# git 1.9.0+ allows for exclusions in pathspecs via ':!foo' syntax.
# However, until git 2.13.0 there must be at least one "inclusive" pathspec, hence the './*'
trailing_whitespace=$(git grep -E -n -- ' +$' -- './*' ':!*.png' ':!*.jpg')
if [[ -n "$trailing_whitespace" ]]; then
printf "ERROR: Trailing whitespaces:\n"
awk 'BEGIN {FS=":"} {printf " * %s:%s\n", $1, $2}' <<< "$trailing_whitespace"
exit 1
fi