From 7cb14a2a0bc59219081ca184ae442d92e0124ce1 Mon Sep 17 00:00:00 2001 From: Dmitry Krutskikh Date: Sat, 26 Feb 2022 07:36:27 +0300 Subject: [PATCH 1/5] chore: restrict analyzer version to >=2.8.0 <3.4.0 --- CHANGELOG.md | 2 +- .../rules/rules_list/avoid_returning_widgets/visitor.dart | 2 +- .../rules/rules_list/avoid_unnecessary_setstate/visitor.dart | 2 +- .../rules/rules_list/prefer_extracting_callbacks/visitor.dart | 2 +- .../rules/rules_list/prefer_single_widget_per_file/visitor.dart | 2 +- pubspec.yaml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6248f580c7..c4dc25ca61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## Unreleased * **Breaking Change:** cli arguments `--fatal-unused` and `--fatal-warnings` activate by default. -* chore: restrict `analyzer` version to `>=2.8.0 <3.3.0`. +* chore: restrict `analyzer` version to `>=2.8.0 <3.4.0`. * feat: add static code diagnostic `avoid-collection-methods-with-unrelated-types` ## 4.11.0 diff --git a/lib/src/analyzers/lint_analyzer/rules/rules_list/avoid_returning_widgets/visitor.dart b/lib/src/analyzers/lint_analyzer/rules/rules_list/avoid_returning_widgets/visitor.dart index 456e5be364..f852ff6f10 100644 --- a/lib/src/analyzers/lint_analyzer/rules/rules_list/avoid_returning_widgets/visitor.dart +++ b/lib/src/analyzers/lint_analyzer/rules/rules_list/avoid_returning_widgets/visitor.dart @@ -36,7 +36,7 @@ class _Visitor extends RecursiveAstVisitor { @override void visitClassDeclaration(ClassDeclaration node) { - final classType = node.extendsClause?.superclass2.type; + final classType = node.extendsClause?.superclass.type; if (!isWidgetOrSubclass(classType) && !isWidgetStateOrSubclass(classType)) { return; } diff --git a/lib/src/analyzers/lint_analyzer/rules/rules_list/avoid_unnecessary_setstate/visitor.dart b/lib/src/analyzers/lint_analyzer/rules/rules_list/avoid_unnecessary_setstate/visitor.dart index 4b220889a8..8bb6ba0d6e 100644 --- a/lib/src/analyzers/lint_analyzer/rules/rules_list/avoid_unnecessary_setstate/visitor.dart +++ b/lib/src/analyzers/lint_analyzer/rules/rules_list/avoid_unnecessary_setstate/visitor.dart @@ -14,7 +14,7 @@ class _Visitor extends RecursiveAstVisitor { void visitClassDeclaration(ClassDeclaration node) { super.visitClassDeclaration(node); - final type = node.extendsClause?.superclass2.type; + final type = node.extendsClause?.superclass.type; if (type == null || !isWidgetStateOrSubclass(type)) { return; } diff --git a/lib/src/analyzers/lint_analyzer/rules/rules_list/prefer_extracting_callbacks/visitor.dart b/lib/src/analyzers/lint_analyzer/rules/rules_list/prefer_extracting_callbacks/visitor.dart index 64bce38799..ac0147326c 100644 --- a/lib/src/analyzers/lint_analyzer/rules/rules_list/prefer_extracting_callbacks/visitor.dart +++ b/lib/src/analyzers/lint_analyzer/rules/rules_list/prefer_extracting_callbacks/visitor.dart @@ -11,7 +11,7 @@ class _Visitor extends SimpleAstVisitor { @override void visitClassDeclaration(ClassDeclaration node) { - final classType = node.extendsClause?.superclass2.type; + final classType = node.extendsClause?.superclass.type; if (!isWidgetOrSubclass(classType) && !isWidgetStateOrSubclass(classType)) { return; } diff --git a/lib/src/analyzers/lint_analyzer/rules/rules_list/prefer_single_widget_per_file/visitor.dart b/lib/src/analyzers/lint_analyzer/rules/rules_list/prefer_single_widget_per_file/visitor.dart index 09f4746ef3..a55d2842d3 100644 --- a/lib/src/analyzers/lint_analyzer/rules/rules_list/prefer_single_widget_per_file/visitor.dart +++ b/lib/src/analyzers/lint_analyzer/rules/rules_list/prefer_single_widget_per_file/visitor.dart @@ -15,7 +15,7 @@ class _Visitor extends SimpleAstVisitor { void visitClassDeclaration(ClassDeclaration node) { super.visitClassDeclaration(node); - final classType = node.extendsClause?.superclass2.type; + final classType = node.extendsClause?.superclass.type; if (isWidgetOrSubclass(classType) && (!_ignorePrivateWidgets || !Identifier.isPrivateName(node.name.name))) { _nodes.add(node); diff --git a/pubspec.yaml b/pubspec.yaml index f4fa5fd492..a35abb789a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -10,7 +10,7 @@ environment: sdk: ">=2.14.0 <3.0.0" dependencies: - analyzer: ">=2.8.0 <3.3.0" + analyzer: ">=2.8.0 <3.4.0" analyzer_plugin: ">=0.8.0 <0.10.0" ansicolor: ^2.0.1 args: ^2.0.0 From cd401968a0e258074cb64bdc57874643e4947e85 Mon Sep 17 00:00:00 2001 From: Dmitry Krutskikh Date: Sat, 26 Feb 2022 07:36:51 +0300 Subject: [PATCH 2/5] chore: add missed trailing comma --- .../avoid_collection_methods_with_unrelated_types_rule.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/src/analyzers/lint_analyzer/rules/rules_list/avoid_collection_methods_with_unrelated_types/avoid_collection_methods_with_unrelated_types_rule.dart b/lib/src/analyzers/lint_analyzer/rules/rules_list/avoid_collection_methods_with_unrelated_types/avoid_collection_methods_with_unrelated_types_rule.dart index 7f82b05727..72a0fa9e15 100644 --- a/lib/src/analyzers/lint_analyzer/rules/rules_list/avoid_collection_methods_with_unrelated_types/avoid_collection_methods_with_unrelated_types_rule.dart +++ b/lib/src/analyzers/lint_analyzer/rules/rules_list/avoid_collection_methods_with_unrelated_types/avoid_collection_methods_with_unrelated_types_rule.dart @@ -22,9 +22,9 @@ class AvoidCollectionMethodsWithUnrelatedTypesRule extends CommonRule { static const _warning = 'Avoid collection methods with unrelated types.'; - AvoidCollectionMethodsWithUnrelatedTypesRule( - [Map config = const {}]) - : super( + AvoidCollectionMethodsWithUnrelatedTypesRule([ + Map config = const {}, + ]) : super( id: ruleId, severity: readSeverity(config, Severity.warning), excludes: readExcludes(config), From 0cdf22e65e4dad30368d8b155ff6f90e1055a98a Mon Sep 17 00:00:00 2001 From: Dmitry Krutskikh Date: Sat, 26 Feb 2022 07:37:03 +0300 Subject: [PATCH 3/5] chore: tune lints settings --- analysis_options.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index e04ac038b1..240a826e28 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -70,7 +70,8 @@ dart_code_metrics: exceptions: - id - ok - - prefer-correct-type-name + - prefer-correct-type-name: + max-length: 44 - prefer-first - prefer-last - prefer-match-file-name: From 9e4cd59f7d10ebf324f76e79c18893a66a044d1d Mon Sep 17 00:00:00 2001 From: Dmitry Krutskikh Date: Sat, 26 Feb 2022 07:37:31 +0300 Subject: [PATCH 4/5] fix: update link in documentation --- website/docs/cli/check-unused-files.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/docs/cli/check-unused-files.md b/website/docs/cli/check-unused-files.md index f1f70b9dda..73affee59b 100644 --- a/website/docs/cli/check-unused-files.md +++ b/website/docs/cli/check-unused-files.md @@ -54,7 +54,7 @@ The reporter prints a single JSON object containing meta information and the unu - `formatVersion` - an integer representing the format version (will be incremented each time the serialization format changes) - `timestamp` - a creation time of the report in YYYY-MM-DD HH:MM:SS format -- `unusedFiles` - an array of [unused files](#the-unusedFiles-object-fields-are) +- `unusedFiles` - an array of [unused files](#the-unused-files-object-fields-are) - `automaticallyDeleted` - an indication of unused files being automatically deleted ```JSON @@ -76,7 +76,7 @@ The reporter prints a single JSON object containing meta information and the unu } ``` -#### The **unusedFiles** object fields are {#the-unusedfiles-object-fields-are} +#### The **unusedFiles** object fields are {#the-unused-files-object-fields-are} - `path` - a relative path of the unused file From d832fcfa41e3cebfa48735e69d36ac5d7cede2cf Mon Sep 17 00:00:00 2001 From: Dmitry Krutskikh Date: Sat, 26 Feb 2022 08:06:04 +0300 Subject: [PATCH 5/5] fix --- CHANGELOG.md | 3 ++- pubspec.yaml | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4dc25ca61..666f767704 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,8 @@ ## Unreleased * **Breaking Change:** cli arguments `--fatal-unused` and `--fatal-warnings` activate by default. -* chore: restrict `analyzer` version to `>=2.8.0 <3.4.0`. +* chore: restrict `analyzer` version to `>=3.3.0 <3.4.0`. +* chore: restrict `analyzer_plugin` version to `>=0.9.0 <0.10.0`. * feat: add static code diagnostic `avoid-collection-methods-with-unrelated-types` ## 4.11.0 diff --git a/pubspec.yaml b/pubspec.yaml index a35abb789a..c1139d35e3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -10,8 +10,8 @@ environment: sdk: ">=2.14.0 <3.0.0" dependencies: - analyzer: ">=2.8.0 <3.4.0" - analyzer_plugin: ">=0.8.0 <0.10.0" + analyzer: ">=3.3.0 <3.4.0" + analyzer_plugin: ">=0.9.0 <0.10.0" ansicolor: ^2.0.1 args: ^2.0.0 collection: ^1.15.0