-
Notifications
You must be signed in to change notification settings - Fork 507
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
Update behavior of SA1501 when SA1503 is disabled #1189
Conversation
This commit updates SA1501 to include special handling for the case where SA1503 is disabled. In this scenario, statements are analyzed instead of curly braces. Fixes DotNetAnalyzers#1175
{ | ||
if (i == 0) | ||
Debug.Assert(true); | ||
else |
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.
📝 Not sure yet what causes this result from the code fix.
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.
❓ What happens in this case for testCode
?
if (i == 0)
Debug.Assert(true); else Debug.Assert(false);
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.
In the updated implementation, I believe this does not report SA1501 at all.
There are a couple remaining buggy behaviors in the code fix for this, but it does seem to work decently well overall. I'm a bit short on time so I configured the tests to detect the bugs as the expected behavior and left comments for review. Let me know whether you'd like to see them fixed before merging or if bug reports would be acceptable. |
This commit addresses some inconsistencies by only reporting the first violation of SA1501 on a line. Note that this only applies to cases where SA1503 is disabled.
} | ||
}"; | ||
|
||
var batchFixedTestCode = @"using System.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.
Since batchFixedTestCode
now matches fixedTestCode
should it be removed?
❓ Can you add tests for |
|
👍 |
Update behavior of SA1501 when SA1503 is disabled
This commit updates SA1501 to include special handling for the case where
SA1503 is disabled. In this scenario, statements are analyzed instead of
curly braces.
Fixes #1175