-
Notifications
You must be signed in to change notification settings - Fork 232
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 S6964 FP: Properties with default values #9348
Fix S6964 FP: Properties with default values #9348
Conversation
03c3486
to
124a3dd
Compare
private static bool HasDefaultValue(SyntaxNode node) => node switch | ||
{ | ||
ParameterSyntax { Default: not null } => true, | ||
PropertyDeclarationSyntax { Initializer: not null } property => property.Parent.ParameterList() is null, |
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.
Why property.Parent.ParameterList() is null
? How are property initializers not relevant if there is a primary constructor?
@@ -144,4 +146,11 @@ type switch | |||
|
|||
private static bool HasValidateNeverAttribute(ISymbol symbol) => | |||
symbol.HasAttribute(KnownType.Microsoft_AspNetCore_Mvc_ModelBinding_Validation_ValidateNeverAttribute); | |||
|
|||
private static bool HasDefaultValue(SyntaxNode node) => node switch |
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.
Slightly better name?
private static bool HasDefaultValue(SyntaxNode node) => node switch | |
private static bool IsInitialized(SyntaxNode node) => node switch |
|
|
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
@zsolt-kolbay-sonarsource I removed my self since Martin already checked and approved! |
Fixes #9331