diff --git a/CHANGELOG.md b/CHANGELOG.md index fc1c70adfc..080150c17a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,9 @@ * feat: add alphabetical sorting by type for `member-ordering-extended` rule. * feat: add support mixins, extensions and enums for `prefer-match-file-name` rule. -* fix: prefer conditional expressions rule breaks code with increment / decrement operators -* chore: tune GitHub workflows +* fix: prefer conditional expressions rule breaks code with increment / decrement operators. +* chore: restrict `analyzer` version to `>=2.4.0 <2.9.0`. +* chore: tune GitHub workflows. ## 4.7.0 diff --git a/lib/src/analyzer_plugin/analyzer_plugin.dart b/lib/src/analyzer_plugin/analyzer_plugin.dart index 8823650538..3606414421 100644 --- a/lib/src/analyzer_plugin/analyzer_plugin.dart +++ b/lib/src/analyzer_plugin/analyzer_plugin.dart @@ -142,6 +142,7 @@ class AnalyzerPlugin extends ServerPlugin { ) async { try { final driver = driverForPath(parameters.file) as AnalysisDriver; + // ignore: deprecated_member_use final analysisResult = await driver.getResult2(parameters.file); if (analysisResult is! ResolvedUnitResult) { diff --git a/lib/src/analyzer_plugin/analyzer_plugin_utils.dart b/lib/src/analyzer_plugin/analyzer_plugin_utils.dart index 993600c376..acdfb74b81 100644 --- a/lib/src/analyzer_plugin/analyzer_plugin_utils.dart +++ b/lib/src/analyzer_plugin/analyzer_plugin_utils.dart @@ -43,6 +43,7 @@ plugin.AnalysisErrorFixes codeIssueToAnalysisErrorFixes( plugin.SourceChange(issue.suggestion!.comment, edits: [ plugin.SourceFileEdit( fileWithIssue, + // ignore: deprecated_member_use unitResult.libraryElement.source.modificationStamp, edits: [ plugin.SourceEdit( diff --git a/lib/src/analyzers/lint_analyzer/lint_analyzer.dart b/lib/src/analyzers/lint_analyzer/lint_analyzer.dart index a04fcfd197..35953e0316 100644 --- a/lib/src/analyzers/lint_analyzer/lint_analyzer.dart +++ b/lib/src/analyzers/lint_analyzer/lint_analyzer.dart @@ -370,6 +370,6 @@ class LintAnalyzer { return functionRecords; } - bool _isSupported(AnalysisResult result) => + bool _isSupported(FileResult result) => result.path.endsWith('.dart') && !result.path.endsWith('.g.dart'); } diff --git a/pubspec.yaml b/pubspec.yaml index fd123729c0..ca13879d39 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -10,7 +10,7 @@ environment: sdk: ">=2.14.0 <3.0.0" dependencies: - analyzer: ">=2.4.0 <2.8.0" + analyzer: ">=2.4.0 <2.9.0" analyzer_plugin: ^0.8.0 ansicolor: ^2.0.1 args: ^2.0.0 diff --git a/test/src/analyzer_plugin/analyzer_plugin_utils_test.dart b/test/src/analyzer_plugin/analyzer_plugin_utils_test.dart index 867edb60f5..6c0b31dac2 100644 --- a/test/src/analyzer_plugin/analyzer_plugin_utils_test.dart +++ b/test/src/analyzer_plugin/analyzer_plugin_utils_test.dart @@ -47,6 +47,7 @@ void main() { when(() => libraryElement.source).thenReturn(source); when(() => resolvedUnitResult.libraryElement) .thenReturn(libraryElement); + // ignore: deprecated_member_use when(() => source.modificationStamp).thenReturn(modificationStamp); final fixes = codeIssueToAnalysisErrorFixes( diff --git a/test/src/utils/node_utils_test.dart b/test/src/utils/node_utils_test.dart index 21da6c209a..52cd2a734f 100644 --- a/test/src/utils/node_utils_test.dart +++ b/test/src/utils/node_utils_test.dart @@ -12,8 +12,6 @@ class AnnotatedNodeMock extends Mock implements AnnotatedNode {} class CompilationUnitMock extends Mock implements CompilationUnit {} -class CharacterLocationMock extends Mock implements CharacterLocation {} - class LineInfoMock extends Mock implements LineInfo {} class TokenMock extends Mock implements Token {}