Skip to content
This repository was archived by the owner on Mar 24, 2026. It is now read-only.

Commit ffd1b78

Browse files
authored
Merge pull request #374 from invertase/analyer9
Analyer9
2 parents c587d2e + fc49dac commit ffd1b78

26 files changed

Lines changed: 136 additions & 133 deletions

packages/custom_lint/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## Unreleased patch
2+
3+
Support analyzer 9.0.0
4+
15
## 0.8.1 - 2025-09-09
26

37
Support analyzer 8.0.0

packages/custom_lint/example/example_lint/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ environment:
55
sdk: '>=3.0.0 <4.0.0'
66

77
dependencies:
8-
analyzer: ^8.0.0
8+
analyzer: ^9.0.0
99
analyzer_plugin: ^0.13.0
1010
custom_lint_builder:
1111
path: ../../../custom_lint_builder

packages/custom_lint/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ environment:
88
sdk: ">=3.0.0 <4.0.0"
99

1010
dependencies:
11-
analyzer: ^8.0.0
11+
analyzer: ^9.0.0
1212
analyzer_plugin: ^0.13.0
1313
args: ^2.3.1
1414
async: ^2.9.0

packages/custom_lint/test/cli_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ Analyzing...
315315
TestLintRule(
316316
code: 'hello_world',
317317
message: 'Hello world',
318-
errorSeverity: ErrorSeverity.WARNING,
318+
diagnosticSeverity: DiagnosticSeverity.WARNING,
319319
),
320320
]),
321321
);

packages/custom_lint/test/create_project.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class TestLintRule {
3434
this.onVariable = '',
3535
this.ruleMembers = '',
3636
this.fixes = const [],
37-
this.errorSeverity = ErrorSeverity.INFO,
37+
this.diagnosticSeverity = DiagnosticSeverity.INFO,
3838
});
3939

4040
final String code;
@@ -44,7 +44,7 @@ class TestLintRule {
4444
final String onVariable;
4545
final String ruleMembers;
4646
final List<TestLintFix> fixes;
47-
final ErrorSeverity errorSeverity;
47+
final DiagnosticSeverity diagnosticSeverity;
4848

4949
void run(StringBuffer buffer) {
5050
final fixesCode = fixes.isEmpty
@@ -64,7 +64,7 @@ class $code extends DartLintRule {
6464
: super(
6565
code: LintCode(name: '$code',
6666
problemMessage: '$message',
67-
errorSeverity: ErrorSeverity.${errorSeverity.displayName.toUpperCase()}),
67+
diagnosticSeverity: DiagnosticSeverity.${diagnosticSeverity.displayName.toUpperCase()}),
6868
);
6969
7070
$fixesCode

packages/custom_lint_builder/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## Unreleased patch
2+
3+
Support analyzer 9.0.0
4+
15
## 0.8.1 - 2025-09-09
26

37
Support analyzer 8.0.0

packages/custom_lint_builder/example/example_lint/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ environment:
55
sdk: '>=3.0.0 <4.0.0'
66

77
dependencies:
8-
analyzer: ^8.0.0
8+
analyzer: ^9.0.0
99
analyzer_plugin: ^0.13.0
1010
custom_lint_builder:
1111
path: ../../../custom_lint_builder

packages/custom_lint_builder/lib/src/client.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,7 +1191,7 @@ class _ClientAnalyzerPlugin extends analyzer_plugin.ServerPlugin {
11911191
const code = LintCode(
11921192
name: 'custom_lint_get_lint_fail',
11931193
problemMessage: 'A lint plugin threw an exception',
1194-
errorSeverity: ErrorSeverity.ERROR,
1194+
errorSeverity: DiagnosticSeverity.ERROR,
11951195
);
11961196

11971197
// TODO add context message that points to the fir line of the stacktrace
@@ -1202,7 +1202,7 @@ class _ClientAnalyzerPlugin extends analyzer_plugin.ServerPlugin {
12021202
resolver.lineInfo.lineStarts.elementAtOrNull(1) ?? startOffset;
12031203

12041204
reporter.atOffset(
1205-
errorCode: code,
1205+
diagnosticCode: code,
12061206
offset: startOffset,
12071207
length: endOffset - startOffset,
12081208
);
@@ -1217,13 +1217,13 @@ class _ClientAnalyzerPlugin extends analyzer_plugin.ServerPlugin {
12171217
}
12181218
}
12191219

1220-
class _AnalysisErrorListenerDelegate implements AnalysisErrorListener {
1220+
class _AnalysisErrorListenerDelegate implements DiagnosticListener {
12211221
_AnalysisErrorListenerDelegate(this._onError);
12221222

12231223
final void Function(AnalysisError error) _onError;
12241224

12251225
@override
1226-
void onError(AnalysisError error) => _onError(error);
1226+
void onDiagnostic(AnalysisError error) => _onError(error);
12271227
}
12281228

12291229
extension on ChangeReporterBuilder {

packages/custom_lint_builder/lib/src/custom_analyzer_converter.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class CustomAnalyzerConverter {
2424
plugin.AnalysisError convertAnalysisError(
2525
analyzer.AnalysisError error, {
2626
analyzer.LineInfo? lineInfo,
27-
analyzer.ErrorSeverity? severity,
27+
analyzer.DiagnosticSeverity? severity,
2828
}) {
2929
var errorCode = error.errorCode;
3030
severity ??= errorCode.errorSeverity;
@@ -120,11 +120,11 @@ class CustomAnalyzerConverter {
120120
/// Convert the error [severity] from the 'analyzer' package to an analysis
121121
/// error severity defined by the plugin API.
122122
plugin.AnalysisErrorSeverity convertErrorSeverity(
123-
analyzer.ErrorSeverity severity) =>
123+
analyzer.DiagnosticSeverity severity) =>
124124
plugin.AnalysisErrorSeverity.values.byName(severity.name);
125125

126126
/// Convert the error [type] from the 'analyzer' package to an analysis error
127127
/// type defined by the plugin API.
128-
plugin.AnalysisErrorType convertErrorType(analyzer.ErrorType type) =>
128+
plugin.AnalysisErrorType convertErrorType(analyzer.DiagnosticType type) =>
129129
plugin.AnalysisErrorType.values.byName(type.name);
130130
}

packages/custom_lint_builder/lib/src/expect_lint.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ExpectLint {
2222
'Expected to find the lint {0} on next line but none found.',
2323
correctionMessage: 'Either update the code such that it emits the lint {0} '
2424
'or update the expect_lint clause to not include the code {0}.',
25-
errorSeverity: ErrorSeverity.ERROR,
25+
errorSeverity: DiagnosticSeverity.ERROR,
2626
);
2727

2828
/// The list of lints emitted in the file.
@@ -74,7 +74,7 @@ class ExpectLint {
7474
// Some expect_lint clauses where not respected
7575
for (final unfulfilledExpectedLint in unfulfilledExpectedLints) {
7676
reporter.atOffset(
77-
errorCode: _code,
77+
diagnosticCode: _code,
7878
offset: unfulfilledExpectedLint.offset,
7979
length: unfulfilledExpectedLint.code.length,
8080
arguments: [unfulfilledExpectedLint.code],

0 commit comments

Comments
 (0)