insanity.sh 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/usr/bin/env bash
  2. GREP="git --no-pager grep -n --color"
  3. WARNING="\e[1;34m" # bold light blue
  4. RESET="\e[0m"
  5. _build_negative_match() {
  6. _output=""
  7. for arg in "$@"
  8. do
  9. output+=" --and --not -e \"${arg}\""
  10. done
  11. }
  12. notice() {
  13. echo -e "${WARNING}$1${RESET}"
  14. }
  15. notice 'Checking repeating words... (e.g. "voice voice")'
  16. _build_negative_match " ha ha " " no no " " sweet sweet " " low low "\
  17. " that that " " really really " " so so "\
  18. " her her "
  19. $GREP -e " \(\b[a-zA-Z][a-zA-Z]\+\) \1\b ""$output" -- locations/
  20. notice 'Checking bad articles... (e.g. "a automatic" or "an color")'
  21. $GREP -i -E "\Wa (a|e|i|o|u)." -- locations/ | grep -a -i -vE "\Wa (un|eu|us|ut|on|ur|in)."
  22. notice "-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-"
  23. $GREP -i -E "\Wan (b|c|d|f|g|j|k|l|m|n|p|q|r|s|t|v|w|x|y|z)\w+" -- locations/
  24. notice 'Checking bad tags... (e.g. "<<\$var><")'
  25. $GREP -a -E '<<\$[^>]+><' -- locations/
  26. notice 'Checking common typos... (e.g. "recieve")'
  27. $GREP -i -a -E "\W(recieve|carress)" -- locations/