-
Notifications
You must be signed in to change notification settings - Fork 237
Fix S2190 FN: Support indexer, conversion operator and event declaration #8464
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
Fix S2190 FN: Support indexer, conversion operator and event declaration #8464
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Can you please increase the coverage and fix the 3 issues? |
|
I fixed the code smells and opened an issue for the rest of the FPs that remain in the file. Regarding the coverage I could not come up with any valid or invalid code snippet that would cover the cases, however I would rather leave it there as defensive coding than to create AD0001s if anything changes in Roslyn. |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
|
cristian-ambrosini-sonarsource
left a comment
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.
Left few ideas to bump the coverage
analyzers/src/SonarAnalyzer.CSharp/Rules/InfiniteRecursion.RoslynCfg.cs
Outdated
Show resolved
Hide resolved
| OperationKindEx.Binary => | ||
| IBinaryOperationWrapper.FromOperation(operation).OperatorMethod, | ||
| OperationKindEx.Decrement => | ||
| IIncrementOrDecrementOperationWrapper.FromOperation(operation).OperatorMethod, |
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's weird because this line is tested in InfiniteRecursion.CSharp11.cs through:
public class Decrement : IDecrementOperators<Decrement>
{
public static Decrement operator --(Decrement val) => --val; // Noncompliant
}same for Unary:
public class BitWise : IBitwiseOperators<BitWise, BitWise, BitWise>
{
public static BitWise operator ~(BitWise value) => ~value; // Noncompliant
public static BitWise operator &(BitWise left, BitWise right) => left & right; // Noncompliant
public static BitWise operator |(BitWise left, BitWise right) => left | right; // Noncompliant
public static BitWise operator ^(BitWise left, BitWise right) => left ^ right; // Noncompliant
}but the code coverage tool is not detecting those lines as covered.
analyzers/src/SonarAnalyzer.CSharp/Rules/InfiniteRecursion.RoslynCfg.cs
Outdated
Show resolved
Hide resolved
e1a8872 to
a687f6d
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
c93ac86 to
adc4a56
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
CristianAmbrosini
left a comment
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! Feel free to rebase and merge
|
@sagi1623 Freedom! Finally 😄 |
75138c7 to
d65b763
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
|





Fixes #6642
Fixes #6643
Fixes #6644