Skip to content
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: Property with a default value #9331

Closed
DerGary opened this issue May 24, 2024 · 1 comment · Fixed by #9348
Closed

Fix S6964 FP: Property with a default value #9331

DerGary opened this issue May 24, 2024 · 1 comment · Fixed by #9348
Assignees
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

Comments

@DerGary
Copy link

DerGary commented May 24, 2024

Description

S6964 is reporting an error on properties with a default value

Repro steps

public record Data
{
    public bool SomeProperty { get; init; } = false;
}

Expected behavior

The rule is not reported as the property contains a default value

Actual behavior

The rule is triggered and a warning is reported

Known workarounds

ignore the rule

Related information

  • MSBuild / dotnet version
    dotnet 8
  • SonarScanner for .NET version (if used)
    6.2.0
  • Operating System
    linux
@zsolt-kolbay-sonarsource zsolt-kolbay-sonarsource changed the title Fix S6964 FP/FN: rule should not be raised in case of property with a default value Fix S6964 FP: Property with a default value May 27, 2024
@zsolt-kolbay-sonarsource zsolt-kolbay-sonarsource added Type: False Positive Rule IS triggered when it shouldn't be. Area: C# C# rules related issues. Sprint: Hardening Fix FPs/FNs/improvements labels May 27, 2024
@zsolt-kolbay-sonarsource zsolt-kolbay-sonarsource added this to the 9.26 milestone May 27, 2024
@zsolt-kolbay-sonarsource
Copy link
Contributor

Thank you for reporting this. Confirmed as False Positive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: C# C# rules related issues. Sprint: Hardening Fix FPs/FNs/improvements Type: False Positive Rule IS triggered when it shouldn't be.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants