check-format.sh 863 B

1234567891011121314151617181920212223242526272829303132
  1. #!/usr/bin/env bash
  2. ## Used in CI. this scripts wraps format_app.py
  3. ## and check git diff
  4. set -euo pipefail
  5. cd -P -- "$(dirname -- "$0")/.."
  6. APPS=()
  7. APPS+=( 'apps/emqx' 'apps/emqx_modules' 'apps/emqx_gateway')
  8. APPS+=( 'apps/emqx_authn' 'apps/emqx_authz' )
  9. APPS+=( 'lib-ee/emqx_enterprise_conf' 'lib-ee/emqx_license' )
  10. APPS+=( 'apps/emqx_exhook')
  11. APPS+=( 'apps/emqx_retainer' 'apps/emqx_slow_subs')
  12. APPS+=( 'apps/emqx_management')
  13. APPS+=( 'apps/emqx_psk')
  14. APPS+=( 'apps/emqx_plugin_libs' 'apps/emqx_machine' 'apps/emqx_statsd' )
  15. APPS+=( 'apps/emqx_auto_subscribe' 'apps/emqx_conf')
  16. APPS+=( 'apps/emqx_dashboard')
  17. for app in "${APPS[@]}"; do
  18. echo "$app ..."
  19. ./scripts/format_app.py -a "$app" -f
  20. done
  21. DIFF_FILES="$(git diff --name-only)"
  22. if [ "$DIFF_FILES" != '' ]; then
  23. echo "ERROR: Below files need reformat"
  24. echo "$DIFF_FILES"
  25. exit 1
  26. fi