-
Notifications
You must be signed in to change notification settings - Fork 466
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
Fixer for CA1826 #2173
Fixer for CA1826 #2173
Conversation
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.
Thanks for the PR! Overall, you need to be much more defensive in code fixers about what nodes/operations are present in the tree. Additionally, it is hard to review the correctness of a PR without unit tests. I would request adding unit tests prior to requesting second round of review. Thanks!
...time/DoNotUseEnumerableMethodsOnIndexableCollectionsInsteadUseTheCollectionDirectly.Fixer.cs
Outdated
Show resolved
Hide resolved
...time/DoNotUseEnumerableMethodsOnIndexableCollectionsInsteadUseTheCollectionDirectly.Fixer.cs
Outdated
Show resolved
Hide resolved
...time/DoNotUseEnumerableMethodsOnIndexableCollectionsInsteadUseTheCollectionDirectly.Fixer.cs
Outdated
Show resolved
Hide resolved
...time/DoNotUseEnumerableMethodsOnIndexableCollectionsInsteadUseTheCollectionDirectly.Fixer.cs
Outdated
Show resolved
Hide resolved
...time/DoNotUseEnumerableMethodsOnIndexableCollectionsInsteadUseTheCollectionDirectly.Fixer.cs
Outdated
Show resolved
Hide resolved
...time/DoNotUseEnumerableMethodsOnIndexableCollectionsInsteadUseTheCollectionDirectly.Fixer.cs
Outdated
Show resolved
Hide resolved
@mavasani just pushed a new commit with requested fixes as well as unit tests. The bottom two unit tests named As for:
I added a properties dictionary to the analyzer part. This serves two purposes:
If you still think that the fixer should contain those guards regardless, let me know and I'll add them in. Thanks for your help once again. |
...re/Runtime/DoNotUseEnumerableMethodsOnIndexableCollectionsInsteadUseTheCollectionDirectly.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.NetCore.Analyzers/Core/Runtime/xlf/SystemRuntimeAnalyzersResources.cs.xlf
Outdated
Show resolved
Hide resolved
...time/DoNotUseEnumerableMethodsOnIndexableCollectionsInsteadUseTheCollectionDirectly.Fixer.cs
Outdated
Show resolved
Hide resolved
...time/DoNotUseEnumerableMethodsOnIndexableCollectionsInsteadUseTheCollectionDirectly.Fixer.cs
Outdated
Show resolved
Hide resolved
...time/DoNotUseEnumerableMethodsOnIndexableCollectionsInsteadUseTheCollectionDirectly.Fixer.cs
Outdated
Show resolved
Hide resolved
...DoNotUseEnumerableMethodsOnIndexableCollectionsInsteadUseTheCollectionDirectlyTests.Fixer.cs
Outdated
Show resolved
Hide resolved
...DoNotUseEnumerableMethodsOnIndexableCollectionsInsteadUseTheCollectionDirectlyTests.Fixer.cs
Outdated
Show resolved
Hide resolved
...time/DoNotUseEnumerableMethodsOnIndexableCollectionsInsteadUseTheCollectionDirectly.Fixer.cs
Outdated
Show resolved
Hide resolved
@mavasani just pushed the changes addressing the 2nd code review. I'll resolve those conversations now. |
...time/DoNotUseEnumerableMethodsOnIndexableCollectionsInsteadUseTheCollectionDirectly.Fixer.cs
Outdated
Show resolved
Hide resolved
...DoNotUseEnumerableMethodsOnIndexableCollectionsInsteadUseTheCollectionDirectlyTests.Fixer.cs
Show resolved
Hide resolved
...DoNotUseEnumerableMethodsOnIndexableCollectionsInsteadUseTheCollectionDirectlyTests.Fixer.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.
LGTM. Primary pending request is for adding a VisualBasic unit test.
Thanks for the contribution!
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.
Marking as request changes as we have a layering violation in the code fixer implementation, that must be fixed prior to merging this in.
…eMethodsOnIndexableCollectionsInsteadUseTheCollectionDirectly.Fixer.cs Co-Authored-By: TKharaishvili <tor.kharaishvili@gmail.com>
...DoNotUseEnumerableMethodsOnIndexableCollectionsInsteadUseTheCollectionDirectlyTests.Fixer.cs
Show resolved
Hide resolved
@mavasani I tried to make it work for VB too but wasn't able to. I also opened up a review, please have a look at that as well. Thanks. |
...time/DoNotUseEnumerableMethodsOnIndexableCollectionsInsteadUseTheCollectionDirectly.Fixer.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.
Thanks!
@mavasani thanks to you too! Couldn't have done this without your guidance. |
@TKharaishvili Can you resolve the merge conflicts? I'd start by just resolving the conflict in |
@mavasani I resolved that file in the github ui. But I'm not sure how to trigger rebuild from here... |
Not sure if that is supported. You'll probably have to do it locally by deleting the xlf folder on your machine and rebuilding and pushing it. |
@mavasani I think it's all finished |
Addresses the issue - #1932
The changes in this PR are obviously not ideal, some of the issues being:
Enumerable.First
but hey it does work for C# and hopefully you guys can help me deal with the rough edges.