-
Notifications
You must be signed in to change notification settings - Fork 468
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
Instantiate ArgumentExceptions Correctly analyzer updates and fixer implementation #3500
Conversation
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/MicrosoftNetCoreAnalyzersResources.resx
Outdated
Show resolved
Hide resolved
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/MicrosoftNetCoreAnalyzersResources.resx
Outdated
Show resolved
Hide resolved
src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/MicrosoftNetCoreAnalyzersResources.resx
Show resolved
Hide resolved
...Analyzers/Core/Microsoft.NetCore.Analyzers/Runtime/InstantiateArgumentExceptionsCorrectly.cs
Show resolved
Hide resolved
...Analyzers/Core/Microsoft.NetCore.Analyzers/Runtime/InstantiateArgumentExceptionsCorrectly.cs
Outdated
Show resolved
Hide resolved
...rp/Microsoft.NetCore.Analyzers/Runtime/CSharpInstantiateArgumentExceptionsCorrectly.Fixer.cs
Outdated
Show resolved
Hide resolved
...rp/Microsoft.NetCore.Analyzers/Runtime/CSharpInstantiateArgumentExceptionsCorrectly.Fixer.cs
Outdated
Show resolved
Hide resolved
...rp/Microsoft.NetCore.Analyzers/Runtime/CSharpInstantiateArgumentExceptionsCorrectly.Fixer.cs
Outdated
Show resolved
Hide resolved
...rp/Microsoft.NetCore.Analyzers/Runtime/CSharpInstantiateArgumentExceptionsCorrectly.Fixer.cs
Outdated
Show resolved
Hide resolved
...rp/Microsoft.NetCore.Analyzers/Runtime/CSharpInstantiateArgumentExceptionsCorrectly.Fixer.cs
Outdated
Show resolved
Hide resolved
...rp/Microsoft.NetCore.Analyzers/Runtime/CSharpInstantiateArgumentExceptionsCorrectly.Fixer.cs
Outdated
Show resolved
Hide resolved
...ers/Core/Microsoft.NetCore.Analyzers/Runtime/InstantiateArgumentExceptionsCorrectly.Fixer.cs
Show resolved
Hide resolved
...UnitTests/Microsoft.NetCore.Analyzers/Runtime/InstantiateArgumentExceptionsCorrectlyTests.cs
Show resolved
Hide resolved
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.
Overall, this looks pretty good to me. I'll do another pass once you can move the fixer to IOperation based language agnostic implementation. It would be fine to add just 1-2 VB code fix tests, your current coverage for C# tests looks good to me.
...UnitTests/Microsoft.NetCore.Analyzers/Runtime/InstantiateArgumentExceptionsCorrectlyTests.cs
Outdated
Show resolved
Hide resolved
...sic/Microsoft.NetCore.Analyzers/Runtime/BasicInstantiateArgumentExceptionsCorrectly.Fixer.vb
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #3500 +/- ##
========================================
Coverage 95.10% 95.10%
========================================
Files 1050 1053 +3
Lines 237440 238137 +697
Branches 15389 15496 +107
========================================
+ Hits 225807 226484 +677
- Misses 9931 9933 +2
- Partials 1702 1720 +18 |
End Sub | ||
End Class", | ||
GetBasicIncorrectMessageExpectedResult(4, 15, "Test", "first", "message", "ArgumentException"), @" | ||
Public Class [MyClass] |
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.
Somehow indented sources not matching for VB tests, not sure why, will try to fix later
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.
it seems not really depending from my code/fixer, Document editor might have issue with replacing VB node, @mavasani any suggestions?
...Analyzers/Core/Microsoft.NetCore.Analyzers/Runtime/InstantiateArgumentExceptionsCorrectly.cs
Outdated
Show resolved
Hide resolved
...UnitTests/Microsoft.NetCore.Analyzers/Runtime/InstantiateArgumentExceptionsCorrectlyTests.cs
Outdated
Show resolved
Hide resolved
...Analyzers/Core/Microsoft.NetCore.Analyzers/Runtime/InstantiateArgumentExceptionsCorrectly.cs
Outdated
Show resolved
Hide resolved
...UnitTests/Microsoft.NetCore.Analyzers/Runtime/InstantiateArgumentExceptionsCorrectlyTests.cs
Show resolved
Hide resolved
...ers/Core/Microsoft.NetCore.Analyzers/Runtime/InstantiateArgumentExceptionsCorrectly.Fixer.cs
Show resolved
Hide resolved
...ers/Core/Microsoft.NetCore.Analyzers/Runtime/InstantiateArgumentExceptionsCorrectly.Fixer.cs
Outdated
Show resolved
Hide resolved
...ers/Core/Microsoft.NetCore.Analyzers/Runtime/InstantiateArgumentExceptionsCorrectly.Fixer.cs
Outdated
Show resolved
Hide resolved
...Analyzers/Core/Microsoft.NetCore.Analyzers/Runtime/InstantiateArgumentExceptionsCorrectly.cs
Outdated
Show resolved
Hide resolved
...UnitTests/Microsoft.NetCore.Analyzers/Runtime/InstantiateArgumentExceptionsCorrectlyTests.cs
Show resolved
Hide resolved
} | ||
|
||
[Fact] | ||
public async Task EditorConfigConfiguredPublic_PrivateMethods_TriggeringOtherRules_DoesNotWarn() |
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 this test becomes redundant if you take the approach suggested in https://github.com/dotnet/roslyn-analyzers/pull/3500/files#r413392484, which also validates that flipping the accessibility of the method from private to public on the same test generates diagnostics.
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.
Its not really testing that, the MatchesConfiguredVisibility(...)
method takes DiagnosticDescriptor argument, for which i passed one of the 3 descriptors of the analyzer, i was wondering if i need ot call that method for each descriptor or it will work for all, and it is testing if the api surface option works for other descriptors even if i didn't checked that especially for those descriptors
...ers/Core/Microsoft.NetCore.Analyzers/Runtime/InstantiateArgumentExceptionsCorrectly.Fixer.cs
Outdated
Show resolved
Hide resolved
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.
Mostly LGTM. I think it should be good to sign off once you add the suggested tests and some other minor feedback.
Fixes dotnet/runtime#33763
CSharp only version for fixer, please suggest how to make it more language ignostic waylanguage agnostic fixer