diff --git a/check.sh b/check.sh new file mode 100755 index 0000000..23597f6 --- /dev/null +++ b/check.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +cd "$DIR" + +# Keep exclusions sorted. And list them here. +# +# - SC2002 is useless use of cat +# +exclusions="SC2002" + +source "$DIR/framework/versions" + +if [[ $# -ne 0 ]]; then + shellcheck --exclude="$exclusions" "$@" + exit $? +fi + +shell_scripts="$(fd .sh | xargs)" + +# The files we need to check all either end in .sh or else they're the files +# in framework/cmd.d and framework/shims. -x instructs shellcheck to also +# check `source`d files. + +shellcheck -x --exclude="$exclusions" "$DIR/cmd" "$DIR"/framework/cmd.d/* "$DIR"/framework/shims/* "$shell_scripts" + +pushd "$DIR/master" +docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:$golangci_lint golangci-lint run +popd diff --git a/fixup.sh b/fixup.sh new file mode 100755 index 0000000..43f86f4 --- /dev/null +++ b/fixup.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +set -eu + +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +cd "$DIR" + +# uv run ruff check --select I --fix . + +# uv run ruff format . + +shell_scripts="$(fd .sh | xargs)" +shfmt -i 4 -w "$DIR/cmd" "$DIR"/framework/cmd.d/* "$DIR"/framework/shims/* +# "$shell_scripts" +for ss in $shell_scripts; do + shfmt -i 4 -w $ss +done + +pushd "$DIR/master" +go fmt +popd