dotnet / aspnetcore Public
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
Use NetAnalyzers from SDK instead of FxCopAnalyzers #30138
Conversation
There CA1310 violations like: aspnetcore/src/Razor/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentBindLoweringPass.cs Line 499 in c925f99
Do you want me to pass a StringComparison.Ordinal, or StringComparison.Invariant, or disable the rule? I'm not sure why the |
…s. Due to value boxing, this call will always return false.
@pranavkm or @NTaylorMullen any ideas on why it doesn't already fail?
I definitely prefer Ordinal
comparisons whenever possible, especially for language keyword comparisons.
src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/.editorconfig
Outdated
Show resolved
Hide resolved
{ | ||
return false; | ||
} | ||
|
||
return left.Equals(right); |
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.
Note - safe because SourceSpan
is a struct, so can't be null, and will never be ReferenceEquals
.
Looks good so far - let me know when you're done. |
.editorconfig
Outdated
dotnet_diagnostic.CA1305.severity = error | ||
dotnet_diagnostic.CA1310.severity = error | ||
# Temporarily disabling, waiting on PR feedback to re-enable | ||
dotnet_diagnostic.CA1310.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.
There are some violations of CA1305 from https://github.com/aspnet/MessagePack-CSharp.git which is imported through gitmodules. I'll move this specific rule to .editorconfig instead of .globalconfig as a workaround. |
This should be ready for another look. |
This looks good to me, but I'd like @pranavkm or @NTaylorMullen to make sure they agree with me about the Ordinal
comparisons in the Razor compiler before we merge.
@@ -52,7 +52,7 @@ private bool ShouldSkip() | |||
|
|||
var targetQueue = GetTargetHelixQueue().ToLowerInvariant(); | |||
|
|||
if (Queues.Contains("All.OSX") && targetQueue.StartsWith("osx")) | |||
if (Queues.Contains("All.OSX") && targetQueue.StartsWith("osx", StringComparison.OrdinalIgnoreCase)) |
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.
if (Queues.Contains("All.OSX") && targetQueue.StartsWith("osx", StringComparison.OrdinalIgnoreCase)) | |
if (Queues.Contains("All.OSX") && targetQueue.StartsWith("osx", StringComparison.Ordinal)) |
That would be the equivalent to the previous check
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'll let this be. This is test-only code so it doesn't make a difference.
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.
@HaoK actually asked to change this to OrdinalIgnoreCase as part of this review.
…e#30138) * Use analyzers from .NET SDK Commit migrated from dotnet/aspnetcore@350ea5b
Fixes #30099
Replaces FxCopAnalyzers package references with NetAnalyzers.(Used from .NET SDK instead of package)@sharwell Can you review?
The text was updated successfully, but these errors were encountered: