ImgScroll/utils/style.sh
2017-06-19 10:45:11 -07:00

28 lines
1.4 KiB
Bash

echo ""
echo "====================================================="
echo "Tabs are not allowed"
echo "-----------------------------------------------------"
git grep -n -P "\t" -- :/*.java | sed -e "s/\t/\x1b[7m--->\x1b[m/g"
echo "====================================================="
echo ""
echo "====================================================="
echo "Trailing whitespace is not allowed"
echo "-----------------------------------------------------"
git grep -n -P "[ \t]+$" -- :/*.java | sed -e "s/\t/\x1b[7m--->\x1b[m/g" | sed -e "s/ /\x1b[7m.\x1b[m/g" | sed -e "s/$/\x1b[7m$\x1b[m/g"
echo "====================================================="
echo ""
echo "====================================================="
echo "'){' is not allowed. Place a space between ')' and '{', i.e. 'if (a) {'"
echo "-----------------------------------------------------"
git grep -n -P "\)\{" -- :/*.java
echo "====================================================="
echo ""
echo "====================================================="
echo "A space is required after keywords (if|else|for|while|do|try|catch|finally)"
echo "-----------------------------------------------------"
git grep -n -P "(\b(if|for|while|catch)\b[(])|(\b(else|do|try|finally)\b[{])" -- :/*.java | sed -r -e "s/(\b(if|for|while|catch)\b[(])|(\b(else|do|try|finally)\b[{])/\x1b[7m\0\x1b[m/g"
echo "====================================================="