-
Notifications
You must be signed in to change notification settings - Fork 25
Issue 167 1 #186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 167 1 #186
Conversation
yurii-prykhodko-solid
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add at least one test per each rule, where we check whether the exclusion logic is working properly.
And please make sure the pipeline is passing.
lib/src/lints/avoid_unused_parameters/models/avoid_unused_parameters.dart
Show resolved
Hide resolved
lib/src/lints/avoid_returning_widgets/models/avoid_returning_widgets_parameters.dart
Outdated
Show resolved
Hide resolved
lib/src/lints/avoid_unused_parameters/avoid_unused_parameters_rule.dart
Outdated
Show resolved
Hide resolved
lib/src/lints/cyclomatic_complexity/cyclomatic_complexity_rule.dart
Outdated
Show resolved
Hide resolved
lib/src/lints/function_lines_of_code/models/function_lines_of_code_parameters.dart
Show resolved
Hide resolved
lib/src/lints/no_empty_block/models/no_empty_block_parameters.dart
Outdated
Show resolved
Hide resolved
lib/src/lints/no_empty_block/models/no_empty_block_parameters.dart
Outdated
Show resolved
Hide resolved
| final excludedItem = | ||
| exclude.firstWhereOrNull((e) => e.methodName == methodName); | ||
| final excludedItem = exclude.firstWhereOrNull( | ||
| (e) => e.methodName == methodName || e.className == methodName, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This removes some confusion.
And also highlights that we may not be comparing what we think we should be comparing.
We should check whether the declaration is a class before running exclude.className == declarationName; same for method names.
| (e) => e.methodName == methodName || e.className == methodName, | |
| (e) => e.methodName == declarationName || e.className == declarationName, |
yurii-prykhodko-solid
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, almost there. Please add tests for plain-string exclude.
| - method_name: longFunctionExcluded | ||
| - method_name: longMethodExcluded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change this back. If no tests fail -- we're good to go.
| - method_name: longFunctionExcluded | |
| - method_name: longMethodExcluded | |
| - longFunctionExcluded | |
| - longMethodExcluded |
| for (final item in excludeList) { | ||
| if (item is Map) { | ||
| exclude.add(ExcludedIdentifierParameter.fromJson(item)); | ||
| } else if (item is String) { | ||
| exclude.add( | ||
| ExcludedIdentifierParameter( | ||
| declarationName: item, | ||
| ), | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can replace all this with a call to another factory, to avoid duplication
return ExcludedIdentifiersListParameter.fromJson(excludeList: excludeList);
No description provided.