Migrate avoid_late_keyword rule (default behavior) and tests#231
Migrate avoid_late_keyword rule (default behavior) and tests#231Islam-Shaaban-Ibrahim wants to merge 1 commit intoanalysis_server_migrationfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request migrates the AvoidLateKeywordRule to the AnalysisRule framework, introducing a dedicated visitor and unit tests. The review highlights a regression where configuration parameters for ignoring types and allowing initializers were removed, and notes a missing import in the visitor class that will cause a compilation error.
| class AvoidLateKeywordRule extends AnalysisRule { | ||
| static const String _lintName = 'avoid_late_keyword'; | ||
|
|
||
| AvoidLateKeywordRule._(super.config); | ||
| static const LintCode _code = LintCode( | ||
| _lintName, | ||
| 'Avoid using the "late" keyword. It may result in runtime exceptions.', | ||
| ); |
There was a problem hiding this comment.
The migration to AnalysisRule has removed support for the allow_initialized and ignored_types configuration parameters that were present in the previous SolidLintRule implementation. While the PR title mentions "default behavior", this is a regression for users who rely on these settings (e.g., ignoring AnimationController). Furthermore, the class documentation (lines 15-25) still references these parameters, which is now misleading. Please consider either restoring parameter support or updating the documentation to reflect the current implementation.
| import 'package:analyzer/dart/ast/ast.dart'; | ||
| import 'package:analyzer/dart/ast/visitor.dart'; | ||
| import 'package:solid_lints/src/lints/avoid_late_keyword/avoid_late_keyword_rule.dart'; |
There was a problem hiding this comment.
The isLate extension method used on line 15 is missing its required import. It was previously provided by package:solid_lints/src/utils/types_utils.dart. Without this import, the code will fail to compile.
| import 'package:analyzer/dart/ast/ast.dart'; | |
| import 'package:analyzer/dart/ast/visitor.dart'; | |
| import 'package:solid_lints/src/lints/avoid_late_keyword/avoid_late_keyword_rule.dart'; | |
| import 'package:analyzer/dart/ast/ast.dart'; | |
| import 'package:analyzer/dart/ast/visitor.dart'; | |
| import 'package:solid_lints/src/lints/avoid_late_keyword/avoid_late_keyword_rule.dart'; | |
| import 'package:solid_lints/src/utils/types_utils.dart'; |
|
@Islam-Shaaban-Ibrahim, I believe this rule needs custom params to allow users to configure it. |
No description provided.