cram/tools/fmt.sh

23 lines
511 B
Bash
Executable file

#!/usr/bin/env bash
set -euox pipefail
cd "$(git rev-parse --show-toplevel)"
bazel build //tools/...
DIRS=(tools src/python test/python)
function brl() {
bin="$1"
shift
bazel build "//${bin}"
"bazel-bin/${bin}/$(basename ${bin})" "$@"
return "$?"
}
for d in "${DIRS[@]}"; do
if [ -d "$d" ]; then
brl tools/autoflake --remove-all-unused-imports -ir $(realpath "$d")
brl tools/isort $(realpath "$d")
brl tools/unify --quote '"' -ir $(realpath "$d")
fi
done