Created
January 14, 2016 15:08
-
-
Save alex-min/82d124e204a512ac3802 to your computer and use it in GitHub Desktop.
catches some style problems cane and tailor might miss
This file contains 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 | |
# done quickly, don't look here | |
# this catches some style problems cane and tailor might miss | |
echo "---- Doing checks -----" | |
echo "[+] additional space" | |
find "$PWD" | grep -F .rb | grep -v schema.rb | xargs pcregrep -n -M "\n\nend" | |
find "$PWD" | grep -E '\.e?rb$' | xargs grep -nE ' $' | |
echo "[+] missing space" | |
find "$PWD" | grep -E '\.e?rb$' | grep -v schema.rb | xargs grep -nE "[A-Za-Z]:['\"]" | |
echo "[+] additional space" | |
find "$PWD" | grep -F '.erb' | xargs grep -nE '<[a-Za-Z]+ ' | |
find "$PWD" | grep -F '.erb' | xargs grep -nE '= +' | |
find "$PWD" | grep -F '.erb' | xargs grep -nE '<% +' | |
find "$PWD" | grep -F '.erb' | xargs grep -nE '<%.* +%>' | |
find "$PWD" | grep -F '.rb' | xargs grep -nE '( + = )|( = +)' | |
echo "[+] additional space after tag, should maybe be nbsp;" | |
find "$PWD" | grep -F '.erb' | xargs grep -nE '[a-z]> [a-zA-Z]' | |
find "$PWD" | grep -F '.erb' | xargs grep -nE '[a-zA-Z] +</[a-z]' | |
echo "[+] missing space" | |
find "$PWD" | grep -F '.erb' | xargs grep -nE '<%[a-zA-Z]' | |
find "$PWD" | grep -F '.erb' | xargs grep -nE '<%=[a-zA-Z]' | |
find "$PWD" | grep -F '.erb' | xargs grep -nE '[a-zA-Z]%>' | |
echo "[+] useless semicolon" | |
find "$PWD" | grep -F '.rb' | xargs grep -nE ';$' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment