checks.bash: improve checks

- Don't check spelling for *.json files or the contents of the .terraform directory.

- Don't check directories for license headers.

Change-Id: I6961b341cfddc2f9a216443d687e32213b75cd28
Reviewed-on: https://go-review.googlesource.com/c/pkgsite-metrics/+/471035
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
diff --git a/checks.bash b/checks.bash
index 1b41e8e..ee962ca 100755
--- a/checks.bash
+++ b/checks.bash
@@ -33,11 +33,13 @@
   if [[ "$@" != "" ]]; then
     for FILE in $@
     do
+      if [ -f $FILE ]; then
         line="$(head -4 $FILE)"
         if [[ ! $line == *"The Go Authors. All rights reserved."* ]] &&
          [[ ! $line == "// DO NOT EDIT. This file was copied from" ]]; then
               err "missing license header: $FILE"
         fi
+      fi
     done
   fi
 }
@@ -83,7 +85,9 @@
 # check_misspell runs misspell on source files.
 check_misspell() {
   ensure_go_binary github.com/client9/misspell/cmd/misspell
-  runcmd misspell -error $(find . -name .git -prune -o -type f -not -name modules.txt -not -name *.svg -not -name *.ts.snap)
+  runcmd misspell -error $(find . -name .git -prune \
+    -o -name .terraform -prune \
+    -o -type f -not -name modules.txt -not -name '*.svg' -not -name '*.ts.snap' -not -name '*.json')
 }
 
 go_linters() {