diff --git a/scripts/bats/bats b/scripts/bats/bats new file mode 160000 index 00000000..f7defb94 --- /dev/null +++ b/scripts/bats/bats @@ -0,0 +1 @@ +Subproject commit f7defb94362f2053a3e73d13086a167448ea9133 diff --git a/shell/linters/protobuf.sh b/shell/linters/protobuf.sh index 18269be8..349c0f06 100644 --- a/shell/linters/protobuf.sh +++ b/shell/linters/protobuf.sh @@ -5,22 +5,34 @@ # shellcheck disable=SC2034 extensions=(proto) +load_tool() { + "$DIR/gobin.sh" -p github.com/bufbuild/buf/cmd/buf@v"$(get_tool_version "buf")" +} + buf_linter() { # Why: We're OK with this. # shellcheck disable=SC2155 - local PROTOFMT=$("$DIR/gobin.sh" -p github.com/bufbuild/buf/cmd/buf@v"$(get_tool_version "buf")") + local PROTOFMT=$(load_tool) find_files_with_extensions "${extensions[@]}" | xargs -n1 "$PROTOFMT" format --exit-code --diff } buf_formatter() { # Why: We're OK with this. # shellcheck disable=SC2155 - local PROTOFMT=$("$DIR/gobin.sh" -p github.com/bufbuild/buf/cmd/buf@v"$(get_tool_version "buf")") + local PROTOFMT=$(load_tool) find_files_with_extensions "${extensions[@]}" | xargs -n1 "$PROTOFMT" format -w } +buf_lint_linter() { + # Why: We're OK with this. + # shellcheck disable=SC2155 + local PROTOFMT=$(load_tool) + find_files_with_extensions "${extensions[@]}" | xargs -n1 "$PROTOFMT" lint --path +} + linter() { run_command "buf" buf_linter + run_command "buf" buf_lint_linter } formatter() {