-
Notifications
You must be signed in to change notification settings - Fork 228
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 S3963 FP: Static constructor with conditional and no static filed initialization #9512
Conversation
86818a2
to
c8b617e
Compare
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 - mino polishing - ignore if you wish as it does not worth blocking the whole PR for this.
@@ -54,7 +54,7 @@ public sealed class InitializeStaticFieldsInline : SonarDiagnosticAnalyzer | |||
.Distinct() | |||
.Count(); | |||
var hasIfOrSwitch = Array.Exists(bodyDescendantNodes, x => x.IsAnyKind(SyntaxKind.IfStatement, SyntaxKind.SwitchStatement)); | |||
if ((hasIfOrSwitch && assignedFieldCount <= 1) | |||
if ((hasIfOrSwitch && assignedFieldCount == 1) |
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.
one line :)
c6dcd53
to
789f38c
Compare
Quality Gate passed for 'Sonar .NET Java Plugin'Issues Measures |
Quality Gate passed for 'SonarAnalyzer for .NET'Issues Measures |
Peach validation:
|
Fixes #6343