pull/1641/merge
Matt Butcher 9 years ago committed by GitHub
commit f37359331d

@ -16,22 +16,32 @@
set -euo pipefail set -euo pipefail
IFS=$'\n\t' IFS=$'\n\t'
license='Licensed under the Apache License, Version 2.0'
find_files() { find_files() {
find . -not \( \ find . -type f -not \( \
\( \ \( \
-wholename './vendor' \ -wholename './vendor' \
-o -wholename './pkg/proto' \ -o -wholename './pkg/proto' \
-o -wholename '*testdata*' \ -o -wholename '*testdata*' \
\) -prune \ \) -prune \
\) \ \) \
\( -name '*.go' -o -name '*.sh' -o -name 'Dockerfile' \) \( -name '*.go' -o -name '*.sh' -o -name 'Dockerfile' \) \
-not \( -exec git check-ignore -q {}+ \; \)
} }
failed=($(find_files | xargs grep -L 'Licensed under the Apache License, Version 2.0 (the "License");'))
if (( ${#failed[@]} > 0 )); then if type "ag" > /dev/null 2>&1 ; then
echo "Some source files are missing license headers." # ag automatically skips anything in .gitignore
for f in "${failed[@]}"; do ag -L "$license" --go --shell --ignore pkg/proto --ignore testdata --ignore completions.bash
echo " $f" else
done failed=($(find_files | xargs grep -L "$license"))
exit 1 if (( ${#failed[@]} > 0 )); then
echo "Some source files are missing license headers."
for f in "${failed[@]}"; do
echo " $f"
done
exit 1
fi
fi fi

Loading…
Cancel
Save