-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Enable string comparison FxCop rules #24567
Conversation
Tagging @dotnet/aspdoi |
[*.cs] | ||
dotnet_diagnostic.CA1307.severity = none | ||
dotnet_diagnostic.CA1308.severity = none | ||
dotnet_diagnostic.CA1309.severity = none |
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.
We should eventually fix the 3 violations in this directory and remove this, but I figured I'd at least push something that runs the "restore" step.
I pinged @GrabYourPitchforks about this. It looks like there are some open issues with the analyzer: dotnet/roslyn-analyzers#2581. The build error we're seeing is also incorrect:
Should we hold off on this? |
That linked issue does seem pretty significant to me. We probably should wait for it to be fixed before enabling that rule. @mavasani - any idea of timelines for fixing dotnet/roslyn-analyzers#2581. |
@Pilchie I'll try to pick it up early next week. |
The underlying issue was fixed with dotnet/roslyn-analyzers#4035. Next NuGet package that should soon get published today at https://dev.azure.com/dnceng/public/_packaging?_a=package&feed=dotnet5&package=Microsoft.CodeAnalysis.FxCopAnalyzers&protocolType=NuGet&version=3.3.1-beta1.20417.2&view=versions should have the fix. |
@@ -42,3 +42,8 @@ end_of_line = lf | |||
|
|||
[*.{razor,cshtml}] | |||
charset = utf-8-bom | |||
|
|||
[*.cs] | |||
dotnet_diagnostic.CA1307.severity = error |
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 think you want CA1310 here instead of CA1307 from the latest package.
CA1307 will continue to have its old behavior of being a readability/maintainability rule which provides the recommendation regardless of the default string comparison used by the flagged methid. It has been disabled by default as it can be noisy if you only care about correctness. CA1310 is the new rule which only flags string methods which are known to default to culture specific string comparisons, and is the correctness rule which will not be noisy.
Is that fix only in 3.3.1? Do we know when that will be on nuget? |
Yes, that is correct. No timelines known for 3.3.1. We are even considering completely deprecating FxCopAnalyzers NuGet in favor of equivalent CA analyzers that are now inserted into the .NET SDK: https://docs.microsoft.com/dotnet/fundamentals/productivity/code-analysis |
Yup. Closing this |
One fewer stale PR! Thanks @pranavkm - and thanks for following through on enabling the rules. |
No description provided.