run-shellcheck.sh 695 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh -eu
  2. SHELLCHECKCMD='shellcheck -s sh -f gcc -x'
  3. # Skip SC2154 for variables starting with __ since such variables are cdist
  4. # environment variables.
  5. SHELLCHECK_SKIP=': __.*is referenced but not assigned.*\[SC2154\]'
  6. SHELLCHECKTMP='.shellcheck.tmp'
  7. # Move to top-level cdist-contrib directory.
  8. cd "$(dirname $0)"/..
  9. check() {
  10. find type/ -type f "$@" -exec ${SHELLCHECKCMD} {} + \
  11. | grep -v "${SHELLCHECK_SKIP}" >>"${SHELLCHECKTMP}" || true
  12. }
  13. rm -f "${SHELLCHECKTMP}"
  14. check -path '*/explorer/*'
  15. check -path '*/files/*' -name '*.sh'
  16. check -name manifest
  17. check -name gencode-local
  18. check -name gencode-remote
  19. if test -s "${SHELLCHECKTMP}"
  20. then
  21. cat "${SHELLCHECKTMP}" >&2
  22. exit 1
  23. fi