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.
Projects
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
@github-actions github-actions bot added this to To do in Best Kanban May 27, 2024
@zsolt-kolbay-sonarsource zsolt-kolbay-sonarsource moved this from To do to In progress in Best Kanban 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.

@github-actions github-actions bot moved this from In progress to Review in progress in Best Kanban May 28, 2024
@github-actions github-actions bot moved this from Review in progress to Review approved in Best Kanban May 29, 2024
Best Kanban automation moved this from Review approved to Validate Peach May 29, 2024
@zsolt-kolbay-sonarsource zsolt-kolbay-sonarsource moved this from Validate Peach to Done in Best Kanban May 30, 2024
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
Best Kanban
  
Done
Development

Successfully merging a pull request may close this issue.

4 participants