diff --git a/core/quality/runner/src/real/helm.rs b/core/quality/runner/src/real/helm.rs index 268998552c..0febac4aa6 100644 --- a/core/quality/runner/src/real/helm.rs +++ b/core/quality/runner/src/real/helm.rs @@ -201,14 +201,14 @@ fn chart_paths( Ok((chart_abs, value_paths)) } -fn kubeconform_tool(binary: PathBuf, args: &[String]) -> RealTool { +fn kubeconform_tool(binary: PathBuf) -> RealTool { RealTool { binary, extra_env: Vec::new(), config_rel: None, edition: None, dialect: None, - args: args.to_vec(), + args: Vec::new(), tool_files: Vec::new(), upstream_diagnostics: Vec::new(), search_paths: Vec::new(), @@ -293,7 +293,7 @@ impl RealBackend { &absolute_of, &mut findings, )?; - let kubeconform = kubeconform_tool(kubeconform_binary, &tool.args); + let kubeconform = kubeconform_tool(kubeconform_binary); findings.extend( self.validate_documents("kubeconform", &kubeconform, scratch, config_path, &owned)? .into_iter() diff --git a/core/quality/testdata/matrix/matrix_dart_bad_options.expected.txt b/core/quality/testdata/matrix/matrix_dart_bad_options.expected.txt index 63ebba8716..a367918efc 100644 --- a/core/quality/testdata/matrix/matrix_dart_bad_options.expected.txt +++ b/core/quality/testdata/matrix/matrix_dart_bad_options.expected.txt @@ -1 +1 @@ -pipeline failed: invalid tool output for dart: dart output is outside the pinned grammar: analysis_options.yaml is unusable: undefined_lint: 'no_such_lint_rule' isn't a recognized lint rule. Try using the name of a recognized lint rule. (config core/quality/configs/dart/standard.yaml) +pipeline failed: invalid tool output for dart: dart output is outside the pinned grammar: analysis_options.yaml is unusable: undefined_lint: 'no_such_lint_rule' isn't a recognized lint rule. Try using the name of a recognized lint rule. (config core/quality/configs/dart/config.yaml) diff --git a/core/quality/testdata/matrix/matrix_jupyter_non_python_fail.expected.txt b/core/quality/testdata/matrix/matrix_jupyter_non_python_fail.expected.txt index 80329642f7..4d2f6f63c8 100644 --- a/core/quality/testdata/matrix/matrix_jupyter_non_python_fail.expected.txt +++ b/core/quality/testdata/matrix/matrix_jupyter_non_python_fail.expected.txt @@ -1 +1 @@ -pipeline failed: tool execution failed for ruff: core/quality/testdata/jupyter/r_kernel.ipynb: notebook language is "R"; ruff checks only Python notebooks (config core/quality/configs/ruff/standard.toml) +pipeline failed: tool execution failed for ruff: core/quality/testdata/jupyter/r_kernel.ipynb: notebook language is "R"; ruff checks only Python notebooks (config core/quality/configs/ruff/config.toml) diff --git a/core/quality/tests/fixtures/consumer_policy/BUILD.bazel b/core/quality/tests/fixtures/consumer_policy/BUILD.bazel index 66ade674d5..4c5eec42c7 100644 --- a/core/quality/tests/fixtures/consumer_policy/BUILD.bazel +++ b/core/quality/tests/fixtures/consumer_policy/BUILD.bazel @@ -20,13 +20,31 @@ exports_files([ workspace_policy( name = "shared_policy", bases = [ - "//core/quality/configs/gersemi:config", - "//core/quality/configs/hlint:config", - "//core/quality/configs/julialint:config", - "//core/quality/configs/mbake:config", - ], - configs = ["//core/quality/configs/ansible_lint:config","//core/quality/configs/bicep:config","//core/quality/configs/buildifier:config","//core/quality/configs/checkmake:config","//core/quality/configs/cmakelint:config","//core/quality/configs/credo:config","//core/quality/configs/docstrfmt:config","//core/quality/configs/detekt:config","//core/quality/configs/elvis:config","//core/quality/configs/pmd:config","//core/quality/configs/selene:config","//core/quality/configs/stylua:config","//core/quality/configs/scalafix:config","//core/quality/configs/regal:config","//core/quality/configs/roslyn:config","//core/quality/configs/sqlfluff:config","//core/quality/configs/tflint:config","//core/quality/configs/yamllint:config", + "//core/quality/configs/gersemi:config", + "//core/quality/configs/hlint:config", + "//core/quality/configs/julialint:config", + "//core/quality/configs/mbake:config", + ], + configs = [ ":policy_rubocop_config", + "//core/quality/configs/ansible_lint:config", + "//core/quality/configs/bicep:config", + "//core/quality/configs/buildifier:config", + "//core/quality/configs/checkmake:config", + "//core/quality/configs/cmakelint:config", + "//core/quality/configs/credo:config", + "//core/quality/configs/detekt:config", + "//core/quality/configs/docstrfmt:config", + "//core/quality/configs/elvis:config", + "//core/quality/configs/pmd:config", + "//core/quality/configs/regal:config", + "//core/quality/configs/roslyn:config", + "//core/quality/configs/scalafix:config", + "//core/quality/configs/selene:config", + "//core/quality/configs/sqlfluff:config", + "//core/quality/configs/stylua:config", + "//core/quality/configs/tflint:config", + "//core/quality/configs/yamllint:config", ], families = [ ":ansible_family", diff --git a/dockerfile/private/quality/dockerfile.bzl b/dockerfile/private/quality/dockerfile.bzl index 0a8ca692d7..47a3989744 100644 --- a/dockerfile/private/quality/dockerfile.bzl +++ b/dockerfile/private/quality/dockerfile.bzl @@ -30,8 +30,7 @@ HOOK_ORDER = [] HOOKS = {} def _hadolint_hook(_target, _ctx, _resolved, _capability, _what, _shared): - """Passes `strict`, which turns on the Dockerfile guard.""" - return real_context(options = {"args": ["strict"]}) + return real_context() _CFG = real_config( tools = TOOLS, diff --git a/dockerfile/tests/BUILD.bazel b/dockerfile/tests/BUILD.bazel index e66fe403f6..afee657d9b 100644 --- a/dockerfile/tests/BUILD.bazel +++ b/dockerfile/tests/BUILD.bazel @@ -2,7 +2,6 @@ load("@rules_dx//core/quality:fixtures.bzl", "real_source_target") load("//core:failure_test.bzl", "failure_test") load("//dockerfile:defs.bzl", "dockerfile_library") load(":defs_tests.bzl", "owns_dockerfile_class_test") -load(":guard_tests.bzl", "dockerfile_guard_test") dockerfile_library( name = "app", @@ -29,19 +28,12 @@ failure_test( target = ":bad_name", ) -dockerfile_guard_test( - name = "guard_test", - size = "small", - target = ":app", -) - real_source_target( name = "corpus_starlark", testonly = True, starlark_srcs = [ "BUILD.bazel", "defs_tests.bzl", - "guard_tests.bzl", ], tags = ["corpus"], ) diff --git a/dockerfile/tests/guard_tests.bzl b/dockerfile/tests/guard_tests.bzl deleted file mode 100644 index 4d7bfcaa62..0000000000 --- a/dockerfile/tests/guard_tests.bzl +++ /dev/null @@ -1,34 +0,0 @@ -"""Analysis tests for the Dockerfile guard switch in the lint request.""" - -load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts") -load("//dockerfile/private/quality:dockerfile.bzl", "real_dockerfile_lint_aspect") - -_LintActionsInfo = provider(doc = "Actions of the subject under the Dockerfile lint aspect.", fields = {"actions": "list of actions"}) - -def _subject_impl(ctx): - return [_LintActionsInfo(actions = ctx.attr.target.actions)] - -_subject = rule( - implementation = _subject_impl, - doc = "Forwards the actions of target under the Dockerfile lint aspect.", - attrs = {"target": attr.label(mandatory = True, aspects = [real_dockerfile_lint_aspect])}, -) - -def _guard_impl(ctx): - env = analysistest.begin(ctx) - requests = [ - a.content - for a in analysistest.target_under_test(env)[_LintActionsInfo].actions - if a.mnemonic == "FileWrite" and "-real-lint" in a.outputs.to_list()[0].basename and a.outputs.to_list()[0].basename.endswith("-request.json") - ] - asserts.equals(env, 1, len(requests), "want one lint request") - tools = json.decode(requests[0])["tools"] if len(requests) == 1 else {} - asserts.equals(env, ["strict"], tools.get("hadolint", {}).get("args", [])) - return analysistest.end(env) - -_guard_test = analysistest.make(_guard_impl) - -def dockerfile_guard_test(name, target, size): - """Asserts that the lint request of target turns on the guard.""" - _subject(name = name + "_subject", target = target, testonly = True) - _guard_test(name = name, size = size, target_under_test = name + "_subject") diff --git a/kubernetes/private/quality/kubernetes.bzl b/kubernetes/private/quality/kubernetes.bzl index 731d390120..39788c4cb2 100644 --- a/kubernetes/private/quality/kubernetes.bzl +++ b/kubernetes/private/quality/kubernetes.bzl @@ -51,10 +51,8 @@ def _helm_context(target, ctx, what, tool = "helm"): ) return context -_KUBECONFORM_ARGS = ["strict"] - def _kubeconform_hook(_target, _ctx, _resolved, _capability, _what, _shared): - return real_context(options = {"args": _KUBECONFORM_ARGS}) + return real_context() def _helm_hook(target, ctx, _resolved, _capability, what, _shared): context = _helm_context(target, ctx, what) @@ -73,7 +71,7 @@ def _helm_hook(target, ctx, _resolved, _capability, what, _shared): tool_files = tool_files, inputs = inputs, resolve_pairs = pairs, - options = {"args": _KUBECONFORM_ARGS, "path_tools": [("kubeconform", ctx.file._kubeconform)]}, + options = {"path_tools": [("kubeconform", ctx.file._kubeconform)]}, ) def _trivy_hook(target, ctx, _resolved, _capability, what, _shared): diff --git a/zig/private/quality/zig.bzl b/zig/private/quality/zig.bzl index 41eeeb2a1e..db4f1513ed 100644 --- a/zig/private/quality/zig.bzl +++ b/zig/private/quality/zig.bzl @@ -49,8 +49,7 @@ HOOK_ORDER = [] HOOKS = {} def _zig_ast_check_hook(_target, _ctx, _resolved, _capability, _what, _shared): - """Passes `strict`, which turns on the banned-pattern guard.""" - return real_context(options = {"args": ["strict"]}) + return real_context() _CFG = real_config( tools = TOOLS, diff --git a/zig/tests/BUILD.bazel b/zig/tests/BUILD.bazel index d23279c60e..de2e11e212 100644 --- a/zig/tests/BUILD.bazel +++ b/zig/tests/BUILD.bazel @@ -4,7 +4,6 @@ load("//core:entry.bzl", "dx_entry_quality_srcs") load("//core:wrapper.bzl", "DX_NO_COVERAGE_COLLECTOR_TAG", "dx_with_tag") load("//core/private/testing:defs.bzl", "expect_equal") load("//zig/private:defs.bzl", "ZIG_COVERAGE_COLLECTOR", "ZIG_QUALITY_TOOLS", "zig_import_name") -load(":guard_tests.bzl", "zig_guard_test") load(":hub_tests.bzl", "zig_hub_tests") load(":mode_tests.bzl", "zig_mode_test", "zig_release_fast_failure_test", "zig_zigopts_failure_test") load(":resolution_tests.bzl", "zig_resolution_tests") @@ -171,12 +170,6 @@ zig_resolution_tests( size = "small", ) -zig_guard_test( - name = "guard_test", - size = "small", - target = "//zig/tests/fixtures/hello:greet", -) - test_suite( name = "fixture_tests", testonly = True, @@ -191,7 +184,6 @@ real_source_target( testonly = True, starlark_srcs = [ "BUILD.bazel", - "guard_tests.bzl", "hub_tests.bzl", "mode_tests.bzl", "resolution_tests.bzl", diff --git a/zig/tests/guard_tests.bzl b/zig/tests/guard_tests.bzl deleted file mode 100644 index 5b91772e20..0000000000 --- a/zig/tests/guard_tests.bzl +++ /dev/null @@ -1,34 +0,0 @@ -"""Analysis tests for the Zig guard switch in the lint request.""" - -load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts") -load("//zig/private/quality:zig.bzl", "real_zig_lint_aspect") - -_LintActionsInfo = provider(doc = "Actions of the subject under the Zig lint aspect.", fields = {"actions": "list of actions"}) - -def _subject_impl(ctx): - return [_LintActionsInfo(actions = ctx.attr.target.actions)] - -_subject = rule( - implementation = _subject_impl, - doc = "Forwards the actions of target under the Zig lint aspect.", - attrs = {"target": attr.label(mandatory = True, aspects = [real_zig_lint_aspect])}, -) - -def _guard_impl(ctx): - env = analysistest.begin(ctx) - requests = [ - a.content - for a in analysistest.target_under_test(env)[_LintActionsInfo].actions - if a.mnemonic == "FileWrite" and "-real-lint" in a.outputs.to_list()[0].basename and a.outputs.to_list()[0].basename.endswith("-request.json") - ] - asserts.equals(env, 1, len(requests), "want one lint request") - tools = json.decode(requests[0])["tools"] if len(requests) == 1 else {} - asserts.equals(env, ["strict"], tools.get("zig_ast_check", {}).get("args", [])) - return analysistest.end(env) - -_guard_test = analysistest.make(_guard_impl) - -def zig_guard_test(name, target, size): - """Asserts that the lint request of target turns on the guard.""" - _subject(name = name + "_subject", target = target, testonly = True) - _guard_test(name = name, size = size, target_under_test = name + "_subject")