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 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", }, ],