2020-04-02 23:10:02 +00:00
|
|
|
#!/usr/bin/env bash
|
2022-09-08 06:48:30 +00:00
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
if [ ! -x "$(command -v astyle_py)" ]; then
|
|
|
|
echo "astyle_py not found, please install astyle_py:"
|
|
|
|
echo " pip install -U astyle_py==VERSION"
|
|
|
|
echo "where VERSION is the same as in .pre-commit-config.yaml."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# "--astyle-version" here has to be in sync with pre-commit-config.yaml.
|
|
|
|
# The rest of the options have to be in sync with the default rules in tools/ci/astyle-rules.yml.
|
|
|
|
astyle_py --astyle-version=3.4.7 \
|
2016-09-01 04:32:05 +00:00
|
|
|
--style=otbs \
|
2019-09-25 03:08:21 +00:00
|
|
|
--attach-namespaces \
|
|
|
|
--attach-classes \
|
2016-09-01 04:32:05 +00:00
|
|
|
--indent=spaces=4 \
|
|
|
|
--convert-tabs \
|
|
|
|
--align-reference=name \
|
|
|
|
--keep-one-line-statements \
|
|
|
|
--pad-header \
|
|
|
|
--pad-oper \
|
2022-09-08 06:48:30 +00:00
|
|
|
--unpad-paren \
|
|
|
|
--max-continuation-indent=120 \
|
2016-09-01 04:32:05 +00:00
|
|
|
"$@"
|