From 539e8e8e962e1e4c927f26bbc78eb9a6fa28f448 Mon Sep 17 00:00:00 2001 From: "Dongmin, Yu" Date: Sat, 29 Aug 2026 19:01:07 +0900 Subject: [PATCH 1/2] linters(dart): parse the JSON analyze output and batch from the project root The default analyze format is documented as user-consumable and unspecified between releases, and its relative paths force one invocation per parent directory. The JSON format reports absolute paths, lowercase rule codes, and uppercase severities, so a batch can be analyzed in one pass from the project root while existing trunk-ignore directives and issue URLs keep working. --- linters/dart/plugin.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/linters/dart/plugin.yaml b/linters/dart/plugin.yaml index 0087b0a4a..2b1997982 100644 --- a/linters/dart/plugin.yaml +++ b/linters/dart/plugin.yaml @@ -60,11 +60,11 @@ lint: - name: analyze output: regex - # The output only includes the filename so in order to use a relative path we need to run from parent. - run_from: ${parent} - parse_regex: - \s*(?P.*) - (?P.*):(?P\d+):(?P\d+) - (?P.*) - - (?P.*) - run: dart analyze --no-fatal-warnings ${target} + # The JSON format reports absolute paths, so a batch can be analyzed in a single pass from + # the project root rather than once per parent directory. The default format is explicitly + # documented as unstable between releases. + run_from: ${root_or_parent_with(analysis_options.yaml)} + parse_regex: '"code":"(?P[^"]+)","severity":"(?P[A-Z]+)","type":"[A-Z_]+","location":\{"file":"(?P[^"]+)","range":\{"start":\{"offset":\d+,"line":(?P\d+),"column":(?P\d+)\}.*?"problemMessage":"(?P[^"]*)"' + run: dart analyze --no-fatal-warnings --format=json ${target} success_codes: [0, 3] batch: true From e92beb34a2d0be59f17e4645b4e71fe83e100552 Mon Sep 17 00:00:00 2001 From: "Dongmin, Yu" Date: Sat, 29 Aug 2026 20:03:20 +0900 Subject: [PATCH 2/2] linters(dart): regenerate the analyze snapshot for JSON messages The JSON output keeps the correction sentence in a separate correctionMessage field, so each recorded message is now the problem message alone. Codes, levels, lines, columns, and issue URLs are unchanged. --- linters/dart/test_data/dart_v3.9.2_basic.check.shot | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/linters/dart/test_data/dart_v3.9.2_basic.check.shot b/linters/dart/test_data/dart_v3.9.2_basic.check.shot index 9f84d2cc6..f5d50db14 100644 --- a/linters/dart/test_data/dart_v3.9.2_basic.check.shot +++ b/linters/dart/test_data/dart_v3.9.2_basic.check.shot @@ -12,7 +12,7 @@ exports[`Testing linter dart test basic 1`] = ` "level": "LEVEL_LOW", "line": "12", "linter": "dart", - "message": "Parameters ''x' and 'y'' could be super parameters. Trying converting ''x' and 'y'' to super parameters.", + "message": "Parameters ''x' and 'y'' could be super parameters.", "targetType": "dart", }, { @@ -24,7 +24,7 @@ exports[`Testing linter dart test basic 1`] = ` "level": "LEVEL_HIGH", "line": "16", "linter": "dart", - "message": "Undefined name 'find'. Try correcting the name to one that is defined, or defining the name.", + "message": "Undefined name 'find'.", "targetType": "dart", }, { @@ -36,7 +36,7 @@ exports[`Testing linter dart test basic 1`] = ` "level": "LEVEL_HIGH", "line": "16", "linter": "dart", - "message": "Undefined name 'empty'. Try correcting the name to one that is defined, or defining the name.", + "message": "Undefined name 'empty'.", "targetType": "dart", }, { @@ -48,7 +48,7 @@ exports[`Testing linter dart test basic 1`] = ` "level": "LEVEL_HIGH", "line": "16", "linter": "dart", - "message": "The function 'expect' isn't defined. Try importing the library that defines 'expect', correcting the name to the name of an existing function, or defining a function named 'expect'.", + "message": "The function 'expect' isn't defined.", "targetType": "dart", }, ],