2022-07-27 23:33:53 +03:00
|
|
|
#!/usr/bin/env bash
|
2022-04-13 15:58:11 +03:00
|
|
|
set -euo pipefail
|
|
|
|
|
2022-07-29 00:10:11 +03:00
|
|
|
cd "$(git rev-parse --show-toplevel)"
|
2022-04-13 15:58:11 +03:00
|
|
|
|
2022-07-29 00:10:11 +03:00
|
|
|
mapfile -t files < \
|
|
|
|
<(git ls-files)
|
|
|
|
mapfile -t scripts < \
|
|
|
|
<(awk '/#!\/usr\/bin\/env/&&FNR==1{print FILENAME}' "${files[@]}")
|
|
|
|
mapfile -t buildfiles < \
|
|
|
|
<(find . \( -name 'WORKSPACE' -o -name 'BUILD' -o -name '*.bzl' \))
|
|
|
|
|
|
|
|
>&2 echo "shellcheck"
|
|
|
|
for f in "${scripts[@]}"; do >&2 echo " $f"; done
|
|
|
|
shellcheck -x "${scripts[@]}"
|
|
|
|
>&2 echo -e "OK\n"
|
|
|
|
|
|
|
|
>&2 echo "buildifier"
|
|
|
|
for f in "${buildfiles[@]}"; do >&2 echo " $f"; done
|
|
|
|
buildifier "${buildfiles[@]}"
|
|
|
|
>&2 echo -e "OK\n"
|