Skip to content

Conversation

@StarovNikita
Copy link
Contributor

No description provided.

Copy link
Collaborator

@yurii-prykhodko-solid yurii-prykhodko-solid left a 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.

final excludedItem =
exclude.firstWhereOrNull((e) => e.methodName == methodName);
final excludedItem = exclude.firstWhereOrNull(
(e) => e.methodName == methodName || e.className == methodName,
Copy link
Collaborator

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.

Suggested change
(e) => e.methodName == methodName || e.className == methodName,
(e) => e.methodName == declarationName || e.className == declarationName,

Copy link
Collaborator

@yurii-prykhodko-solid yurii-prykhodko-solid left a 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.

Comment on lines 10 to 11
- method_name: longFunctionExcluded
- method_name: longMethodExcluded
Copy link
Collaborator

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.

Suggested change
- method_name: longFunctionExcluded
- method_name: longMethodExcluded
- longFunctionExcluded
- longMethodExcluded

Comment on lines 53 to 61
for (final item in excludeList) {
if (item is Map) {
exclude.add(ExcludedIdentifierParameter.fromJson(item));
} else if (item is String) {
exclude.add(
ExcludedIdentifierParameter(
declarationName: item,
),
);
Copy link
Collaborator

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);

@yurii-prykhodko-solid yurii-prykhodko-solid merged commit 3e1711b into solid-software:master Dec 6, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants