format.sh 705 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. if [ ! -x "$(command -v astyle_py)" ]; then
  4. echo "astyle_py not found, please install astyle_py:"
  5. echo " pip install -U astyle_py==VERSION"
  6. echo "where VERSION is the same as in .pre-commit-config.yaml."
  7. exit 1
  8. fi
  9. # "--astyle-version" here has to be in sync with pre-commit-config.yaml.
  10. # The rest of the options have to be in sync with the default rules in tools/ci/astyle-rules.yml.
  11. astyle_py --astyle-version=3.4.7 \
  12. --style=otbs \
  13. --attach-namespaces \
  14. --attach-classes \
  15. --indent=spaces=4 \
  16. --convert-tabs \
  17. --align-reference=name \
  18. --keep-one-line-statements \
  19. --pad-header \
  20. --pad-oper \
  21. --unpad-paren \
  22. --max-continuation-indent=120 \
  23. "$@"