-
Notifications
You must be signed in to change notification settings - Fork 227
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: Should not raise for reference properties in nullable context #9308
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.
Good, but changes are needed to handle all non-nullable reference types, not just strings.
analyzers/src/SonarAnalyzer.CSharp/Rules/AspNet/AvoidUnderPosting.cs
Outdated
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.Test/TestCases/AspNet/AvoidUnderPosting.CSharp8.cs
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.Test/TestCases/AspNet/AvoidUnderPosting.CSharp8.cs
Outdated
Show resolved
Hide resolved
3fea67e
to
9423b57
Compare
4e24132
to
eccb51d
Compare
@@ -23,24 +28,3 @@ public IActionResult Create(ModelUsedInController model) | |||
} | |||
} | |||
} | |||
|
|||
namespace CustomGenerics |
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 were these test cases removed?
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.
Wrong push! I'll revert.
@@ -7,11 +7,16 @@ namespace NullableReferences | |||
public class ModelUsedInController | |||
{ | |||
#nullable enable | |||
public string NonNullableReferenceProperty { get; set; } // Noncompliant | |||
public string NonNullableReferenceProperty { get; set; } |
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.
public string NonNullableReferenceProperty { get; set; } | |
public string NonNullableReferenceProperty { get; set; } // Compliant - ASP.NET Core treats non-nullable reference types as if they were decorated with the [Required] attribute |
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. Please check the last two comments I've added.
Quality Gate passed for 'Sonar .NET Java Plugin'Issues Measures |
Quality Gate passed for 'SonarAnalyzer for .NET'Issues Measures |
Fixes #9284