lint-ci.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/usr/bin/env bash
  2. set -e
  3. script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
  4. cd "${script_path}/.." || exit 1
  5. RED='\033[0;31m'
  6. GREEN='\033[0;32m'
  7. NC='\033[0m' # No Color
  8. FAILURES=0
  9. set +e
  10. for cmd in \
  11. Meta/check-debug-flags.sh \
  12. Meta/check-idl-files.py \
  13. Meta/check-newlines-at-eof.py \
  14. Meta/check-png-sizes.sh \
  15. Meta/check-style.py \
  16. Meta/lint-executable-resources.sh \
  17. Meta/lint-gn.sh \
  18. Meta/lint-prettier.sh \
  19. Meta/lint-python.sh \
  20. Meta/lint-shell-scripts.sh; do
  21. if "${cmd}" "$@"; then
  22. echo -e "[${GREEN}OK${NC}]: ${cmd}"
  23. else
  24. echo -e "[${RED}FAIL${NC}]: ${cmd}"
  25. ((FAILURES+=1))
  26. fi
  27. done
  28. if [ -x ./Build/lagom/bin/IPCMagicLinter ]; then
  29. if { git ls-files '*.ipc' | xargs ./Build/lagom/bin/IPCMagicLinter; }; then
  30. echo -e "[${GREEN}OK${NC}]: IPCMagicLinter (in Meta/lint-ci.sh)"
  31. else
  32. echo -e "[${RED}FAIL${NC}]: IPCMagicLinter (in Meta/lint-ci.sh)"
  33. ((FAILURES+=1))
  34. fi
  35. else
  36. echo -e "[${GREEN}SKIP${NC}]: IPCMagicLinter (in Meta/lint-ci.sh)"
  37. fi
  38. if Meta/lint-clang-format.sh --overwrite-inplace "$@" && git diff --exit-code -- ':*.cpp' ':*.h' ':*.mm'; then
  39. echo -e "[${GREEN}OK${NC}]: Meta/lint-clang-format.sh"
  40. else
  41. echo -e "[${RED}FAIL${NC}]: Meta/lint-clang-format.sh"
  42. ((FAILURES+=1))
  43. fi
  44. if Meta/lint-swift.sh "$@" && git diff --exit-code -- ':*.swift'; then
  45. echo -e "[${GREEN}OK${NC}]: Meta/lint-swift.sh"
  46. else
  47. echo -e "[${RED}FAIL${NC}]: Meta/lint-swift.sh"
  48. ((FAILURES+=1))
  49. fi
  50. exit "${FAILURES}"