-
Notifications
You must be signed in to change notification settings - Fork 485
Implement FxCop CA1307 Specify StringComparison #915
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
Conversation
Tagging @dotnet/roslyn-analysis |
}); | ||
} | ||
|
||
public static IEnumerable<IMethodSymbol> GetMethodOverloadsWithDesiredParameterAtTrailing( |
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.
Add doc comments please.
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.
Added comments
@dotnet-bot retest Windows Release please |
@dotnet/roslyn-analysis good to checkin? |
public static class IEnumerableOfIMethodSymbolExtensions | ||
{ | ||
/// <summary> | ||
/// Returns a list of method symbols from a given list of the method symbols, which has its parameter type as |
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.
Seems like a very specific helper. Are you planning to use this for any future analyzers? Otherwise, I would recommend moving this into the analyzer file.
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.
Yes, this is used in the analyzer SpecifyIFormatProvider.cs
for which I have a PR out #912. This helper will be shared between them
@mavasani Addressed your comments |
👍 |
This change implements the FxCop rule CA1307 to pick the overload with StringComparison if possible.
Modify the diagnostic message to report shorted message and the remainder of the message has been moved to the description. Moved some private helpers over to some extension methods Also the method comparison is not displaystring based instead using Type Symbol comparison
8e58bf2
to
6f81f9c
Compare
</data> | ||
<data name="SpecifyStringComparisonMessage" xml:space="preserve"> | ||
<value>Specify StringComparison</value> | ||
<value>Because the behavior of '{0}' could vary based on the current user's locale settings, replace this call in '{1}' with a call to '{2}'.</value> |
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.
I like the new message much better 👍
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.
Minor grammar suggestion: avoid starting the sentence with "Because". You might want to just remove the term "because" in the diagnostic.
👍 |
bbdeab3
to
3d6a359
Compare
This change implements the FxCop rule CA1307 to pick the overload with
StringComparison if possible.