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

S927 FP fix: Fix cases when generic type arguments are changed #5241

Merged
merged 3 commits into from
Jan 7, 2022

Conversation

csaba-sagi-sonarsource
Copy link
Contributor

Fixes #4370

return true;
}
}
return false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should not be needed.

{
context.ReportIssue(Diagnostic.Create(rule, parameter.GetLocation(), parameter.ValueText, expectedParameter.Name, expectedLocation));
}
}
}

private static bool AreGenericWithDifferentTypes(ITypeSymbol actualType, ITypeSymbol expectedType)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would change this name to something like AreGenericTypeParametersWithDifferentTypes. To be a bit more clear what the method does.
WDYT?

if (actualType is INamedTypeSymbol actualNamedType
&& expectedType is INamedTypeSymbol expectedNamedType)
{
for (var i = 0; i < actualNamedType.TypeArguments.Count(); i++)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For readability maybe extract lines 109-115 in a different method?

Copy link
Contributor

@mary-georgiou-sonarsource mary-georgiou-sonarsource left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems ok, a couple of comments.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 5, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 5, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

Copy link
Contributor

@mary-georgiou-sonarsource mary-georgiou-sonarsource left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mary-georgiou-sonarsource mary-georgiou-sonarsource merged commit 04c06bc into master Jan 7, 2022
@mary-georgiou-sonarsource mary-georgiou-sonarsource deleted the čaba/S927-FP-fix branch January 7, 2022 08:34
@mary-georgiou-sonarsource mary-georgiou-sonarsource modified the milestone: 8.34 Jan 17, 2022
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.

S927 FP : FP when generic type arguments are changed to reflect the actual type they represent.
2 participants