Created
January 17, 2014 17:31
-
-
Save soyo42/e70ab19424b91529da78 to your computer and use it in GitHub Desktop.
explore file header - check for copyright string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" ]; then | |
echo "usage:: $0 <project root folder>" | |
exit 1 | |
fi | |
cnt=0 | |
while read i; do | |
output="$(diff -u <(sed -n -e "4,7 p" "$i" | sed -r "s/\r//g") header)" | |
if (( $? != 0 )); then | |
echo "#$i" | |
echo "${output}" | |
(( cnt++ )) | |
fi | |
done < <(find -L "$1" \( -path "*/target" -or -path "*/.git" -or -path "*/third-party" \) -prune \ | |
-or \( -type f -and \( -name '*.java' -or -name '*.xtend' \) \) | grep -v -E '(\/.git|\/target|\/third-party)$') | |
echo -e "\n! MISSING HEADER COUNT: ${cnt}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment