File tree Expand file tree Collapse file tree 3 files changed +22
-6
lines changed
lib/src/common/parameters Expand file tree Collapse file tree 3 files changed +22
-6
lines changed Original file line number Diff line number Diff line change 11/// Model class for ExcludeRule parameters
22class ExcludedIdentifierParameter {
33 /// The name of the method that should be excluded from the lint.
4- final String methodName;
4+ final String ? methodName;
55
66 /// The name of the class that should be excluded from the lint.
77 final String ? className;
88
9+ /// The name of the plain Strings that should be excluded from the lint
10+ final String ? declarationName;
11+
912 /// Constructor for [ExcludedIdentifierParameter] model
1013 const ExcludedIdentifierParameter ({
11- required this .methodName,
14+ this .methodName,
1215 this .className,
16+ this .declarationName,
1317 });
1418
1519 ///
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ class ExcludedIdentifiersListParameter {
2929 } else if (item is String ) {
3030 exclude.add (
3131 ExcludedIdentifierParameter (
32- methodName : item,
32+ declarationName : item,
3333 ),
3434 );
3535 }
@@ -56,7 +56,7 @@ class ExcludedIdentifiersListParameter {
5656 } else if (item is String ) {
5757 exclude.add (
5858 ExcludedIdentifierParameter (
59- methodName : item,
59+ declarationName : item,
6060 ),
6161 );
6262 }
@@ -68,10 +68,21 @@ class ExcludedIdentifiersListParameter {
6868
6969 /// Returns whether the target node should be ignored during analysis.
7070 bool shouldIgnore (Declaration node) {
71- final declaredName = node.declaredElement? .name;
71+ final declarationName = node.declaredElement? .name;
7272
7373 final excludedItem = exclude.firstWhereOrNull (
74- (e) => e.methodName == declaredName || e.className == declaredName,
74+ (e) {
75+ if (e.declarationName == declarationName) {
76+ return true ;
77+ } else if (node is ClassDeclaration ) {
78+ return e.className == declarationName;
79+ } else if (node is MethodDeclaration ) {
80+ return e.methodName == declarationName;
81+ } else if (node is FunctionDeclaration ) {
82+ return e.methodName == declarationName;
83+ }
84+ return false ;
85+ },
7586 );
7687
7788 if (excludedItem == null ) return false ;
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ custom_lint:
3939 - method_name : excludeMethod
4040 - simpleMethodName
4141 - SimpleClassName
42+ - exclude
4243 - newline_before_return
4344 - no_empty_block :
4445 exclude :
You can’t perform that action at this time.
0 commit comments