Fix S6964 FP: Do not raise in properties with required modifier #9285
Labels
Area: C#
C# rules related issues.
Sprint: Hardening
Fix FPs/FNs/improvements
Type: False Positive
Rule IS triggered when it shouldn't be.
Milestone
Description
The rule S6964 should not be active for model properties that use the
required
keyword. Those properties can never be under-posted because the JSON deserialization for them fails.Repro steps
required
properties (e.g.required int
) and use it in a POST controller method.[Required]
attribute manually.Expected behavior
Rule should not be reported.
Actual behavior
Rule is reported.
Known workarounds
I had to create a new quality profile in SonarCloud to disable the rule completely.
Related information
SonarCloudPrepare@1
task)SonarCloudAnalyze@1
task)windows-latest
build agent on Azure DevOpsThe text was updated successfully, but these errors were encountered: