diff --git a/README.md b/README.md index c71ab3f..b29d0e7 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,6 @@ Below is a list of rules that are not enabled by default together with the reaso | [`unnecessary_await_in_return`](https://dart.dev/tools/linter-rules/unnecessary_await_in_return) | Deprecated | | [`unnecessary_const_in_enum_constructor`](https://dart.dev/tools/linter-rules/unnecessary_const_in_enum_constructor) | Not specified | | [`unnecessary_final`](https://dart.dev/tools/linter-rules/unnecessary_final) | Incompatible with [prefer_final_locals](https://dart.dev/tools/linter-rules/prefer_final_locals) | -| [`unnecessary_primary_constructor_body`](https://dart.dev/tools/linter-rules/unnecessary_primary_constructor_body) | Not specified | | [`unnecessary_type_name_in_constructor`](https://dart.dev/tools/linter-rules/unnecessary_type_name_in_constructor) | Not specified | | [`unreachable_from_main`](https://dart.dev/tools/linter-rules/unreachable_from_main) | Not specified | | [`unsafe_variance`](https://dart.dev/tools/linter-rules/unsafe_variance) | Experimental | diff --git a/lib/analysis_options.11.0.0.yaml b/lib/analysis_options.11.0.0.yaml index 1a9d98d..f75c717 100644 --- a/lib/analysis_options.11.0.0.yaml +++ b/lib/analysis_options.11.0.0.yaml @@ -200,6 +200,7 @@ linter: - unnecessary_nullable_for_final_variable_declarations - unnecessary_overrides - unnecessary_parenthesis + - unnecessary_primary_constructor_body - unnecessary_raw_strings - unnecessary_statements - unnecessary_string_escapes diff --git a/tool/linter_rules/bin/remove_deprecated_rules.dart b/tool/linter_rules/bin/remove_deprecated_rules.dart index ba74acf..866375d 100644 --- a/tool/linter_rules/bin/remove_deprecated_rules.dart +++ b/tool/linter_rules/bin/remove_deprecated_rules.dart @@ -10,9 +10,7 @@ import 'package:yaml_edit/yaml_edit.dart'; /// It will create a new version of the analysis options file and update the /// exclusion reasons file and the table of excluded rules in the README.md /// file. -Future main({ - void Function(String) log = print, -}) async { +Future main({void Function(String) log = print}) async { const basePath = '../../'; final deprecatedRules = await allLinterRules( state: LinterRuleState.deprecated, @@ -30,21 +28,15 @@ Future main({ log('Latest Very Good Analysis version: $latestVersion'); log(''); - final latestVgaRules = await allVeryGoodAnalysisRules( - version: latestVersion, - ); + final latestVgaRules = await allVeryGoodAnalysisRules(version: latestVersion); log('Fetched ${latestVgaRules.length} Very Good Analysis linter rules'); log(''); final deprecatedVgaRules = latestVgaRules - .where( - (rule) => deprecatedRules.any((dartRule) => dartRule.name == rule), - ) + .where((rule) => deprecatedRules.any((dartRule) => dartRule.name == rule)) .toList(); final deprecatedVgaRulesCount = deprecatedVgaRules.length; - log( - 'Found $deprecatedVgaRulesCount deprecated Very Good Analysis rules:', - ); + log('Found $deprecatedVgaRulesCount deprecated Very Good Analysis rules:'); if (deprecatedVgaRulesCount == 0) { log('No deprecated Very Good Analysis rules found.'); @@ -59,9 +51,7 @@ Future main({ //// Update the exclusion reasons file. final currentExclusionReasons = await readExclusionReasons(); final newExclusionReasons = currentExclusionReasons - ..addAll({ - for (final rule in deprecatedVgaRules) rule: 'Deprecated', - }); + ..addAll({for (final rule in deprecatedVgaRules) rule: 'Deprecated'}); await writeExclusionReasons(newExclusionReasons); log('''Updated the exclusion reasons file.'''); log(''); @@ -70,10 +60,7 @@ Future main({ final parts = latestVersion.split('.'); // Increment the minor version. final newVersion = '${parts[0]}.${int.parse(parts[1]) + 1}.0'; - bumpVersion( - newVersion, - basePath: basePath, - ); + bumpVersion(newVersion, basePath: basePath); log('Bumped Very Good Analysis version to $newVersion'); log(''); @@ -81,10 +68,7 @@ Future main({ final analysisOptionsFile = File( '$basePath/lib/analysis_options.$newVersion.yaml', ); - _removeLinterRules( - analysisOptionsFile.path, - deprecatedVgaRules, - ); + _removeLinterRules(analysisOptionsFile.path, deprecatedVgaRules); //// Update the table of excluded rules in the README.md file. final readme = Readme(); diff --git a/tool/linter_rules/exclusion_reasons.json b/tool/linter_rules/exclusion_reasons.json index 1706aaf..8fed2eb 100644 --- a/tool/linter_rules/exclusion_reasons.json +++ b/tool/linter_rules/exclusion_reasons.json @@ -34,7 +34,6 @@ "unnecessary_await_in_return": "Deprecated", "unnecessary_const_in_enum_constructor": "Not specified", "unnecessary_final": "Incompatible with [prefer_final_locals](https://dart.dev/tools/linter-rules/prefer_final_locals)", - "unnecessary_primary_constructor_body": "Not specified", "unnecessary_type_name_in_constructor": "Not specified", "unreachable_from_main": "Not specified", "unsafe_variance": "Experimental", diff --git a/tool/linter_rules/test/src/all_linter_rules_test.dart b/tool/linter_rules/test/src/all_linter_rules_test.dart index 7f1e526..028cf83 100644 --- a/tool/linter_rules/test/src/all_linter_rules_test.dart +++ b/tool/linter_rules/test/src/all_linter_rules_test.dart @@ -63,11 +63,8 @@ void main() { group('allLinterRules', () { test('returns all linter rules non-removed or wip', () async { final linterRules = await allLinterRules( - get: (url, {headers}) async => Response( - minimalFixture, - 200, - headers: headers ?? {}, - ), + get: (url, {headers}) async => + Response(minimalFixture, 200, headers: headers ?? {}), ); expect(linterRules.length, 2); @@ -76,11 +73,8 @@ void main() { test('filters rules correctly', () async { final linterRules = await allLinterRules( state: LinterRuleState.deprecated, - get: (url, {headers}) async => Response( - minimalFixture, - 200, - headers: headers ?? {}, - ), + get: (url, {headers}) async => + Response(minimalFixture, 200, headers: headers ?? {}), ); expect(linterRules.length, 1); diff --git a/tool/linter_rules/test/src/latest_vga_version_test.dart b/tool/linter_rules/test/src/latest_vga_version_test.dart index 948868d..adf9e48 100644 --- a/tool/linter_rules/test/src/latest_vga_version_test.dart +++ b/tool/linter_rules/test/src/latest_vga_version_test.dart @@ -16,17 +16,14 @@ void main() { ); }); - test( - 'throws $ArgumentError if the version is not found in ' - 'the given file path', - () { - expect( - () => latestVgaVersion( - filePath: 'test/test_data/corrupted_analysis_options.yaml', - ), - throwsA(isA()), - ); - }, - ); + test('throws $ArgumentError if the version is not found in ' + 'the given file path', () { + expect( + () => latestVgaVersion( + filePath: 'test/test_data/corrupted_analysis_options.yaml', + ), + throwsA(isA()), + ); + }); }); }