From 9089c4eb356a98dc0828e47715b760bdbea3513f Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Thu, 17 Oct 2024 16:13:05 -0700 Subject: [PATCH] Add rules_shell fixing Currently these are split into 3 rules because 1 rule cannot add 3 load statements and this repo doesn't have a defs.bzl that exposes them all --- WARNINGS.md | 33 ++++++++++++++ buildifier/config/config_test.go | 12 +++++ buildifier/integration_test.sh | 3 ++ warn/docs/warnings.textproto | 21 +++++++++ warn/warn.go | 3 ++ warn/warn_bazel_api.go | 22 +++++++++- warn/warn_bazel_api_test.go | 75 ++++++++++++++++++++++++++++++++ 7 files changed, 168 insertions(+), 1 deletion(-) diff --git a/WARNINGS.md b/WARNINGS.md index 5ee0af111..460d89ec2 100644 --- a/WARNINGS.md +++ b/WARNINGS.md @@ -44,6 +44,9 @@ Warning categories supported by buildifier's linter: * [`native-package`](#native-package) * [`native-proto`](#native-proto) * [`native-py`](#native-py) + * [`native-sh-binary`](#native-sh-binary) + * [`native-sh-library`](#native-sh-library) + * [`native-sh-test`](#native-sh-test) * [`no-effect`](#no-effect) * [`out-of-order-load`](#out-of-order-load) * [`output-group`](#output-group) @@ -754,6 +757,36 @@ at the moment it's not required to load Starlark rules. -------------------------------------------------------------------------------- +## sh_binary build rules should be loaded from Starlark + + * Category name: `native-sh-binary` + * Automatic fix: yes + * [Suppress the warning](#suppress): `# buildifier: disable=native-sh-binary` + +The sh_binary build rules should be loaded from Starlark. + +-------------------------------------------------------------------------------- + +## sh_library build rules should be loaded from Starlark + + * Category name: `native-sh-library` + * Automatic fix: yes + * [Suppress the warning](#suppress): `# buildifier: disable=native-sh-library` + +The sh_library build rules should be loaded from Starlark. + +-------------------------------------------------------------------------------- + +## sh_test build rules should be loaded from Starlark + + * Category name: `native-sh-test` + * Automatic fix: yes + * [Suppress the warning](#suppress): `# buildifier: disable=native-sh-test` + +The sh_test build rules should be loaded from Starlark. + +-------------------------------------------------------------------------------- + ## Expression result is not used * Category name: `no-effect` diff --git a/buildifier/config/config_test.go b/buildifier/config/config_test.go index ff120d393..ea59e11dd 100644 --- a/buildifier/config/config_test.go +++ b/buildifier/config/config_test.go @@ -83,6 +83,9 @@ func ExampleExample() { // "native-package", // "native-proto", // "native-py", + // "native-sh-binary", + // "native-sh-library", + // "native-sh-test", // "no-effect", // "output-group", // "overly-nested-depset", @@ -264,6 +267,9 @@ func TestValidate(t *testing.T) { "native-package", "native-proto", "native-py", + "native-sh-binary", + "native-sh-library", + "native-sh-test", "no-effect", "output-group", "overly-nested-depset", @@ -326,6 +332,9 @@ func TestValidate(t *testing.T) { "native-package", // "native-proto", // "native-py", + "native-sh-binary", + "native-sh-library", + "native-sh-test", "no-effect", "output-group", "overly-nested-depset", @@ -387,6 +396,9 @@ func TestValidate(t *testing.T) { "native-package", // "native-proto", // "native-py", + "native-sh-binary", + "native-sh-library", + "native-sh-test", "no-effect", "output-group", "overly-nested-depset", diff --git a/buildifier/integration_test.sh b/buildifier/integration_test.sh index 3c1173b3b..85bee3d7b 100755 --- a/buildifier/integration_test.sh +++ b/buildifier/integration_test.sh @@ -288,6 +288,9 @@ cat > golden/.buildifier.example.json <