1
Fork 0
hermetic_cc_toolchain/ci/lint

27 lines
683 B
Bash
Executable File

#!/usr/bin/env bash
# Copyright 2023 Uber Technologies, Inc.
# Licensed under the Apache License, Version 2.0
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
if command -v shellcheck &> /dev/null; then
mapfile -t files < \
<(git ls-files)
mapfile -t scripts < \
<(awk '/#!(\/usr\/bin\/env bash|\/bin\/sh)/&&FNR==1{print FILENAME}' "${files[@]}")
>&2 echo "shellcheck"
for f in "${scripts[@]}"; do >&2 echo " $f"; done
shellcheck "${scripts[@]}"
>&2 echo -e "OK\n"
fi
>&2 echo "--- buildifier :bazel:"
bin/buildifier -r -mode check "$PWD"
>&2 echo -e "OK\n"
>&2 echo "--- Gazelle :goat:"
tools/bazel run //:gazelle -- -mode diff