File tree Expand file tree Collapse file tree 4 files changed +11
-11
lines changed
lib/src/lints/no_empty_block Expand file tree Collapse file tree 4 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -3,25 +3,25 @@ import 'package:solid_lints/src/common/parameters/excluded_identifiers_list_para
33/// A data model class that represents the "no empty block" lint input
44/// parameters.
55class NoEmptyBlockParameters {
6- static const _allowCommentsConfig = 'allow_comments ' ;
6+ static const _allowWithCommentsConfig = 'allow_with_comments ' ;
77
88 /// A list of methods that should be excluded from the lint.
99 final ExcludedIdentifiersListParameter exclude;
1010
1111 /// Whether to exclude empty blocks that contain any comments.
12- final bool allowComments ;
12+ final bool allowWithComments ;
1313
1414 /// Constructor for [NoEmptyBlockParameters] model
1515 NoEmptyBlockParameters ({
1616 required this .exclude,
17- required this .allowComments ,
17+ required this .allowWithComments ,
1818 });
1919
2020 /// Method for creating from json data
2121 factory NoEmptyBlockParameters .fromJson (Map <String , dynamic > json) {
2222 return NoEmptyBlockParameters (
2323 exclude: ExcludedIdentifiersListParameter .defaultFromJson (json),
24- allowComments : json[_allowCommentsConfig ] as bool ? ?? false ,
24+ allowWithComments : json[_allowWithCommentsConfig ] as bool ? ?? false ,
2525 );
2626 }
2727}
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ class NoEmptyBlockRule extends SolidLintRule<NoEmptyBlockParameters> {
8282 if (isIgnored) return ;
8383
8484 final visitor = NoEmptyBlockVisitor (
85- allowComments : config.parameters.allowComments ,
85+ allowWithComments : config.parameters.allowWithComments ,
8686 );
8787 node.accept (visitor);
8888
Original file line number Diff line number Diff line change @@ -29,15 +29,15 @@ const _todoComment = 'TODO';
2929/// The AST visitor that will find all empty blocks, excluding catch blocks
3030/// and blocks containing [_todoComment]
3131class NoEmptyBlockVisitor extends RecursiveAstVisitor <void > {
32- final bool _allowComments ;
32+ final bool _allowWithComments ;
3333
3434 final _emptyBlocks = < Block > [];
3535
3636 /// Constructor for [NoEmptyBlockVisitor]
37- /// [_allowComments ] indicates whether to allow empty blocks that contain
37+ /// [_allowWithComments ] indicates whether to allow empty blocks that contain
3838 /// any comments
39- NoEmptyBlockVisitor ({required bool allowComments })
40- : _allowComments = allowComments ;
39+ NoEmptyBlockVisitor ({required bool allowWithComments })
40+ : _allowWithComments = allowWithComments ;
4141
4242 /// All empty blocks
4343 Iterable <Block > get emptyBlocks => _emptyBlocks;
@@ -48,7 +48,7 @@ class NoEmptyBlockVisitor extends RecursiveAstVisitor<void> {
4848
4949 if (node.statements.isNotEmpty) return ;
5050 if (node.parent is CatchClause ) return ;
51- if (_allowComments && _isPrecedingCommentAny (node)) return ;
51+ if (_allowWithComments && _isPrecedingCommentAny (node)) return ;
5252 if (_isPrecedingCommentToDo (node)) return ;
5353
5454 _emptyBlocks.add (node);
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ custom_lint:
4242 - exclude
4343 - newline_before_return
4444 - no_empty_block :
45- allow_comments : true
45+ allow_with_comments : true
4646 exclude :
4747 - class_name : Exclude
4848 method_name : excludeMethod
You can’t perform that action at this time.
0 commit comments