Skip to content
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

Merged
merged 15 commits into from
Dec 6, 2024
Merged

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.

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
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