Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/generate/src/tools_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ pub const TOOL_CONFIGS: &[ToolConfig] = &[
kind: "file",
tier_active: true,
tier_base: true,
stage_native: false,
stage_native: true,
tier_source: "dx",
family: "",
extensions: &[],
Expand Down
1 change: 1 addition & 0 deletions javascript/private/quality/js_tools.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ TOOLS = [
config = config(
suffixes = [".json"],
files = ["biome.json"],
stage_native = True,
tier_active = True,
suppressions = ["biome-ignore"],
suppression_extensions = [".cjs", ".css", ".cts", ".js", ".json", ".jsonc", ".jsx", ".mjs", ".mts", ".ts", ".tsx"],
Expand Down
10 changes: 6 additions & 4 deletions quality/testdata/matrix/matrix_css_lint_fail.expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ stages 1
stage stylelint classes=css sources=matrix/stylelint_dirty.css
completed_rounds 1
convergence STABLE
initial 1
initial ERROR stylelint color-no-invalid-hex matrix/stylelint_dirty.css 19 19 fixable=false "Invalid hex color \"#zzz\" (color-no-invalid-hex)"
terminal 1
terminal ERROR stylelint color-no-invalid-hex matrix/stylelint_dirty.css 19 19 fixable=false "Invalid hex color \"#zzz\" (color-no-invalid-hex)"
initial 2
initial WARNING stylelint color-no-invalid-hex matrix/stylelint_dirty.css 19 19 fixable=false "Invalid hex color \"#zzz\" (color-no-invalid-hex)"
initial WARNING stylelint declaration-property-value-no-unknown matrix/stylelint_dirty.css 19 19 fixable=false "Unknown value \"#zzz\" for property \"color\" (declaration-property-value-no-unknown)"
terminal 2
terminal WARNING stylelint color-no-invalid-hex matrix/stylelint_dirty.css 19 19 fixable=false "Invalid hex color \"#zzz\" (color-no-invalid-hex)"
terminal WARNING stylelint declaration-property-value-no-unknown matrix/stylelint_dirty.css 19 19 fixable=false "Unknown value \"#zzz\" for property \"color\" (declaration-property-value-no-unknown)"
replacements 0
6 changes: 2 additions & 4 deletions quality/testdata/matrix/matrix_elixir_lint_fail.expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ stages 1
stage credo classes=elixir sources=matrix/credo_dirty.ex
completed_rounds 1
convergence STABLE
initial 2
initial WARNING credo credo/Readability.ModuleDoc matrix/credo_dirty.ex 10 10 fixable=false "Modules should have a @moduledoc tag."
initial 1
initial WARNING credo credo/Warning.IoInspect matrix/credo_dirty.ex 43 43 fixable=false "There should be no calls to `IO.inspect/1`."
terminal 2
terminal WARNING credo credo/Readability.ModuleDoc matrix/credo_dirty.ex 10 10 fixable=false "Modules should have a @moduledoc tag."
terminal 1
terminal WARNING credo credo/Warning.IoInspect matrix/credo_dirty.ex 43 43 fixable=false "There should be no calls to `IO.inspect/1`."
replacements 0
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ stage credo classes=elixir sources=matrix/credo_broken.ex
completed_rounds 1
convergence STABLE
initial 1
initial ERROR credo credo/syntax matrix/credo_broken.ex 69 69 fixable=false "syntax error before: '*'"
initial WARNING credo credo/syntax matrix/credo_broken.ex 69 69 fixable=false "syntax error before: '*'"
terminal 1
terminal ERROR credo credo/syntax matrix/credo_broken.ex 69 69 fixable=false "syntax error before: '*'"
terminal WARNING credo credo/syntax matrix/credo_broken.ex 69 69 fixable=false "syntax error before: '*'"
replacements 0
12 changes: 8 additions & 4 deletions quality/testdata/matrix/matrix_java_pmd_fail.expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ stages 1
stage pmd classes=java sources=quality/testdata/real_unused.java
completed_rounds 1
convergence STABLE
initial 1
initial INFO pmd UnusedPrivateMethod quality/testdata/real_unused.java 66 72 fixable=false "Avoid unused private methods such as 'helper()'."
terminal 1
terminal INFO pmd UnusedPrivateMethod quality/testdata/real_unused.java 66 72 fixable=false "Avoid unused private methods such as 'helper()'."
initial 3
initial WARNING pmd InstantiableUtilityClass quality/testdata/real_unused.java 35 41 fixable=false "All members are static. Consider adding a private no-args constructor to prevent instantiation."
initial WARNING pmd UnusedPrivateMethod quality/testdata/real_unused.java 66 72 fixable=false "Avoid unused private methods such as 'helper()'."
initial WARNING pmd UncommentedEmptyMethodBody quality/testdata/real_unused.java 75 77 fixable=false "Document empty method body"
terminal 3
terminal WARNING pmd InstantiableUtilityClass quality/testdata/real_unused.java 35 41 fixable=false "All members are static. Consider adding a private no-args constructor to prevent instantiation."
terminal WARNING pmd UnusedPrivateMethod quality/testdata/real_unused.java 66 72 fixable=false "Avoid unused private methods such as 'helper()'."
terminal WARNING pmd UncommentedEmptyMethodBody quality/testdata/real_unused.java 75 77 fixable=false "Document empty method body"
replacements 0
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
producer //quality/testdata:matrix_json_format_pass
capability FORMAT
stages 1
stage biome classes=json sources=quality/testdata/real_clean.json
stage biome classes=json sources=matrix/json_clean.json
completed_rounds 1
convergence STABLE
initial 0
Expand Down
4 changes: 2 additions & 2 deletions quality/testdata/matrix/matrix_json_lint_fail.expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ stage biome classes=json sources=matrix/json_dup.json
completed_rounds 1
convergence STABLE
initial 1
initial ERROR biome lint/suspicious/noDuplicateObjectKeys matrix/json_dup.json 1 4 fixable=false "The key a was already declared."
initial WARNING biome lint/suspicious/noDuplicateObjectKeys matrix/json_dup.json 1 4 fixable=false "The key a was already declared."
terminal 1
terminal ERROR biome lint/suspicious/noDuplicateObjectKeys matrix/json_dup.json 1 4 fixable=false "The key a was already declared."
terminal WARNING biome lint/suspicious/noDuplicateObjectKeys matrix/json_dup.json 1 4 fixable=false "The key a was already declared."
replacements 0
4 changes: 2 additions & 2 deletions quality/testdata/matrix/matrix_jsx_lint_fail.expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ stage biome classes=jsx sources=matrix/jsx_dirty.jsx
completed_rounds 1
convergence STABLE
initial 1
initial WARNING biome lint/correctness/noUnusedVariables matrix/jsx_dirty.jsx 31 37 fixable=false "This variable unused is unused."
initial ERROR biome lint/correctness/noUnusedVariables matrix/jsx_dirty.jsx 31 37 fixable=false "This variable unused is unused."
terminal 1
terminal WARNING biome lint/correctness/noUnusedVariables matrix/jsx_dirty.jsx 31 37 fixable=false "This variable unused is unused."
terminal ERROR biome lint/correctness/noUnusedVariables matrix/jsx_dirty.jsx 31 37 fixable=false "This variable unused is unused."
replacements 0
10 changes: 6 additions & 4 deletions quality/testdata/matrix/matrix_less_lint_fail.expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ stages 1
stage stylelint classes=less sources=matrix/stylelint_dirty.less
completed_rounds 1
convergence STABLE
initial 1
initial ERROR stylelint color-no-invalid-hex matrix/stylelint_dirty.less 19 19 fixable=false "Invalid hex color \"#zzz\" (color-no-invalid-hex)"
terminal 1
terminal ERROR stylelint color-no-invalid-hex matrix/stylelint_dirty.less 19 19 fixable=false "Invalid hex color \"#zzz\" (color-no-invalid-hex)"
initial 2
initial WARNING stylelint color-no-invalid-hex matrix/stylelint_dirty.less 19 19 fixable=false "Invalid hex color \"#zzz\" (color-no-invalid-hex)"
initial WARNING stylelint declaration-property-value-no-unknown matrix/stylelint_dirty.less 19 19 fixable=false "Unknown value \"#zzz\" for property \"color\" (declaration-property-value-no-unknown)"
terminal 2
terminal WARNING stylelint color-no-invalid-hex matrix/stylelint_dirty.less 19 19 fixable=false "Invalid hex color \"#zzz\" (color-no-invalid-hex)"
terminal WARNING stylelint declaration-property-value-no-unknown matrix/stylelint_dirty.less 19 19 fixable=false "Unknown value \"#zzz\" for property \"color\" (declaration-property-value-no-unknown)"
replacements 0
4 changes: 2 additions & 2 deletions quality/testdata/matrix/matrix_lua_lint_fail.expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ stage selene classes=lua sources=matrix/selene_dirty.lua
completed_rounds 1
convergence STABLE
initial 2
initial ERROR selene undefined_variable matrix/selene_dirty.lua 25 32 fixable=false "`missing` is not defined"
initial WARNING selene undefined_variable matrix/selene_dirty.lua 25 32 fixable=false "`missing` is not defined"
initial WARNING selene unused_variable matrix/selene_dirty.lua 55 61 fixable=false "unused is assigned a value, but never used"
terminal 2
terminal ERROR selene undefined_variable matrix/selene_dirty.lua 25 32 fixable=false "`missing` is not defined"
terminal WARNING selene undefined_variable matrix/selene_dirty.lua 25 32 fixable=false "`missing` is not defined"
terminal WARNING selene unused_variable matrix/selene_dirty.lua 55 61 fixable=false "unused is assigned a value, but never used"
replacements 0
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ stage selene classes=lua sources=matrix/selene_broken.lua
completed_rounds 1
convergence STABLE
initial 1
initial ERROR selene parse_error matrix/selene_broken.lua 6 7 fixable=false "unexpected token `=`"
initial WARNING selene parse_error matrix/selene_broken.lua 6 7 fixable=false "unexpected token `=`"
terminal 1
terminal ERROR selene parse_error matrix/selene_broken.lua 6 7 fixable=false "unexpected token `=`"
terminal WARNING selene parse_error matrix/selene_broken.lua 6 7 fixable=false "unexpected token `=`"
replacements 0
10 changes: 6 additions & 4 deletions quality/testdata/matrix/matrix_scss_lint_fail.expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ stages 1
stage stylelint classes=scss sources=matrix/stylelint_dirty.scss
completed_rounds 1
convergence STABLE
initial 1
initial ERROR stylelint color-no-invalid-hex matrix/stylelint_dirty.scss 19 19 fixable=false "Invalid hex color \"#zzz\" (color-no-invalid-hex)"
terminal 1
terminal ERROR stylelint color-no-invalid-hex matrix/stylelint_dirty.scss 19 19 fixable=false "Invalid hex color \"#zzz\" (color-no-invalid-hex)"
initial 2
initial WARNING stylelint color-no-invalid-hex matrix/stylelint_dirty.scss 19 19 fixable=false "Invalid hex color \"#zzz\" (color-no-invalid-hex)"
initial WARNING stylelint declaration-property-value-no-unknown matrix/stylelint_dirty.scss 19 19 fixable=false "Unknown value \"#zzz\" for property \"color\" (declaration-property-value-no-unknown)"
terminal 2
terminal WARNING stylelint color-no-invalid-hex matrix/stylelint_dirty.scss 19 19 fixable=false "Invalid hex color \"#zzz\" (color-no-invalid-hex)"
terminal WARNING stylelint declaration-property-value-no-unknown matrix/stylelint_dirty.scss 19 19 fixable=false "Unknown value \"#zzz\" for property \"color\" (declaration-property-value-no-unknown)"
replacements 0
4 changes: 2 additions & 2 deletions quality/testdata/matrix/matrix_tsx_lint_fail.expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ stage biome classes=tsx sources=matrix/tsx_dirty.tsx
completed_rounds 1
convergence STABLE
initial 1
initial WARNING biome lint/correctness/noUnusedVariables matrix/tsx_dirty.tsx 49 55 fixable=false "This variable unused is unused."
initial ERROR biome lint/correctness/noUnusedVariables matrix/tsx_dirty.tsx 49 55 fixable=false "This variable unused is unused."
terminal 1
terminal WARNING biome lint/correctness/noUnusedVariables matrix/tsx_dirty.tsx 49 55 fixable=false "This variable unused is unused."
terminal ERROR biome lint/correctness/noUnusedVariables matrix/tsx_dirty.tsx 49 55 fixable=false "This variable unused is unused."
replacements 0
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ stage biome classes=typescript sources=quality/testdata/real_dirty.ts
completed_rounds 1
convergence STABLE
initial 1
initial WARNING biome lint/correctness/noUnusedVariables quality/testdata/real_dirty.ts 57 63 fixable=false "This variable unused is unused."
initial ERROR biome lint/correctness/noUnusedVariables quality/testdata/real_dirty.ts 57 63 fixable=false "This variable unused is unused."
terminal 1
terminal WARNING biome lint/correctness/noUnusedVariables quality/testdata/real_dirty.ts 57 63 fixable=false "This variable unused is unused."
terminal ERROR biome lint/correctness/noUnusedVariables quality/testdata/real_dirty.ts 57 63 fixable=false "This variable unused is unused."
replacements 0
4 changes: 4 additions & 0 deletions quality/testdata/runner_matrix_file_family.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,10 @@ FILE_FAMILY_CASES = [
"stages": ["regal;rego;matrix/regal_fail/policy.rego"],
"tool_names": ["regal"],
"tool_binaries": ["@dx_tools//:regal"],
"toolfile_tools": ["regal"],
"toolfile_srcs": ["//quality/tiers/regal:strict.yaml"],
"config_tools": ["regal"],
"config_files": ["//quality/tiers/regal:strict.yaml"],
"expected_file": ":matrix/matrix_rego_lint_fail.expected.txt",
"linux_arm64": True,
"macos_arm64": True,
Expand Down
6 changes: 4 additions & 2 deletions quality/testdata/runner_matrix_json.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ JSON_CASES = [
},
{
"name": "matrix_json_format_pass",
"srcs": [":real_clean.json"],
"generated": {
"matrix/json_clean.json": "{\n\t\"a\": 1\n}\n",
},
"capability": "format",
"stages": ["biome;json;quality/testdata/real_clean.json"],
"stages": ["biome;json;matrix/json_clean.json"],
"tool_names": ["biome"],
"tool_binaries": ["@dx_tools//:biome"],
"expected_file": ":matrix/matrix_json_format_pass.expected.txt",
Expand Down
55 changes: 55 additions & 0 deletions quality/testdata/runner_matrix_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,38 @@

load("//deploy/private:config.bzl", "rlocation_path")
load("//core:canonical.bzl", "is_canonical", "strip_canonical")
load("//quality:native_config.bzl", "DxNativeConfigInfo")
load("//quality:pipeline.bzl", "real_request_stage")
load("//quality:support.bzl", "SUPPORT_PLATFORMS")
load("//quality/private:native_config_impl.bzl", "native_config_scratch_rel", "staged_config_rel", "tier_base_dirs")
load("//rust/private/toolchains:bindings.bzl", "rust_toolchain_toolchains", "rust_toolchain_tools")

# Mirrors TIER_BASE_TOOLS in quality/runner/src/real/staging.rs.
RUNNER_TIER_BASE_TOOLS = [
"bicep",
"biome",
"checkmake",
"credo",
"detekt",
"docstrfmt",
"elvis",
"ffmt",
"gersemi",
"gplint",
"hadolint",
"hlint",
"mbake",
"pmd",
"redocly",
"regal",
"rustfmt",
"scalafix",
"scalafmt",
"selene",
"stylelint",
"tflint",
]

def _single_file(target):
files = target[DefaultInfo].files.to_list()
if len(files) != 1:
Expand Down Expand Up @@ -87,6 +115,20 @@ def _runner_matrix_test_impl(ctx):
configs[tool] = _single_file(ctx.attr.config_files[i]).short_path
if i < len(ctx.attr.config_rels) and ctx.attr.config_rels[i]:
configs[tool] = ctx.attr.config_rels[i]
for i, tool in enumerate(ctx.attr.tier_base_tools):
if tool in configs:
fail("runner_matrix_test: tool '" + tool + "' already has a config; tier base would bind it twice")
info = ctx.attr.tier_bases[i][DxNativeConfigInfo]
config_rel = native_config_scratch_rel(info.config.short_path)
if config_rel == None:
fail("runner_matrix_test: tier base config " + info.config.short_path + " escapes the scratch")
rel = staged_config_rel(tool, config_rel)
configs[tool] = rel
for f in sorted(info.closure.to_list(), key = lambda f: f.short_path):
closure_rel = native_config_scratch_rel(f.short_path)
if closure_rel == None:
fail("runner_matrix_test: tier base file " + f.short_path + " escapes the scratch")
tool_files.append((tool, rel if f == info.config else closure_rel, f))
editions = {}
for i, tool in enumerate(ctx.attr.edition_tools):
editions[tool] = ctx.attr.edition_values[i]
Expand Down Expand Up @@ -314,6 +356,12 @@ _runner_matrix_test = rule(
"config_files": attr.label_list(
allow_files = True,
),
"tier_base_tools": attr.string_list(
doc = "Runner tier-base tools bound to their standard tier base.",
),
"tier_bases": attr.label_list(
providers = [DxNativeConfigInfo],
),
"config_rels": attr.string_list(
doc = "Optional mirror-relative config path per config_files entry; empty keeps the file's short path.",
),
Expand Down Expand Up @@ -419,10 +467,15 @@ def matrix_platform_case_names(cases, platform):
"""Returns the names of the cases that run on `platform`, per `matrix_case_platforms`."""
return [case["name"] for case in cases if platform in matrix_case_platforms(case)]

def _tier_base_tools(case):
bound = case.get("config_tools", []) + case.get("upstream_tools", [])
return [t for t in matrix_case_tools(case) if t in RUNNER_TIER_BASE_TOOLS and t not in bound]

def runner_matrix_suite(name, cases, extra_cases = []):
"""Instantiates one _runner_matrix_test per matrix case plus a suite; extra_cases are existing tests."""
tests = []
for case in cases:
tier_base_tools = _tier_base_tools(case)
_runner_matrix_test(
name = case["name"],
srcs = case.get("srcs", []),
Expand All @@ -446,6 +499,8 @@ def runner_matrix_suite(name, cases, extra_cases = []):
config_tools = case.get("config_tools", []),
config_files = case.get("config_files", []),
config_rels = case.get("config_rels", []),
tier_base_tools = tier_base_tools,
tier_bases = ["//quality/tiers/%s:standard" % tier_base_dirs()[t] for t in tier_base_tools],
edition_tools = case.get("edition_tools", []),
edition_values = case.get("edition_values", []),
dialect_tools = case.get("dialect_tools", []),
Expand Down
Loading