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 S2259 FP/FN: Do not raise on Nullable members #6840

Closed
pavel-mikula-sonarsource opened this issue Mar 2, 2023 · 0 comments · Fixed by #6886
Closed

Fix S2259 FP/FN: Do not raise on Nullable members #6840

pavel-mikula-sonarsource opened this issue Mar 2, 2023 · 0 comments · Fixed by #6886
Assignees
Labels
Area: C# C# rules related issues. Area: VB.NET VB.NET rules related issues. Sprint: SE Short-lived* label for epic MMF-3077 *troll Type: CFG/SE FPs Rule IS triggered when it shouldn't be for CFG and SE rules.
Projects
Milestone

Comments

@pavel-mikula-sonarsource
Copy link
Contributor

In the context of S2259 and S3655, we need to split their responsibility for handling nullable types.

S2259 should not raise on

  • nullable.HasValue
  • nullable.Value
  • nullable.GetValueOrDefault()
  • nullable.Equals(..)
  • nullable.ToString()
  • nullable.GetHashCode()

as those are safe to call when nullable has ObjectConstraint.NullValue, or handled by S3655.

It should still raise on

  • nullable.GetType()
@pavel-mikula-sonarsource pavel-mikula-sonarsource added Area: VB.NET VB.NET rules related issues. Area: C# C# rules related issues. Type: CFG/SE FPs Rule IS triggered when it shouldn't be for CFG and SE rules. Sprint: SE Short-lived* label for epic MMF-3077 *troll labels Mar 2, 2023
@pavel-mikula-sonarsource pavel-mikula-sonarsource added this to the 8.56 milestone Mar 2, 2023
@github-actions github-actions bot added this to To do in Best Kanban Mar 2, 2023
@Tim-Pohlmann Tim-Pohlmann moved this from To do to In progress in Best Kanban Mar 8, 2023
@github-actions github-actions bot moved this from In progress to Review in progress in Best Kanban Mar 9, 2023
@github-actions github-actions bot moved this from Review in progress to In progress in Best Kanban Mar 9, 2023
@github-actions github-actions bot moved this from In progress to Review in progress in Best Kanban Mar 10, 2023
@github-actions github-actions bot moved this from Review in progress to Review approved in Best Kanban Mar 10, 2023
@github-actions github-actions bot moved this from Review approved to Review in progress in Best Kanban Mar 10, 2023
@github-actions github-actions bot moved this from Review in progress to In progress in Best Kanban Mar 10, 2023
@github-actions github-actions bot moved this from In progress to Review in progress in Best Kanban Mar 10, 2023
@github-actions github-actions bot moved this from Review in progress to In progress in Best Kanban Mar 13, 2023
@github-actions github-actions bot moved this from In progress to Review in progress in Best Kanban Mar 14, 2023
@pavel-mikula-sonarsource pavel-mikula-sonarsource moved this from Review in progress to In progress in Best Kanban Mar 14, 2023
@github-actions github-actions bot moved this from In progress to Review in progress in Best Kanban Mar 14, 2023
@github-actions github-actions bot moved this from Review in progress to Review approved in Best Kanban Mar 15, 2023
Best Kanban automation moved this from Review approved to Validate Peach Mar 15, 2023
@Tim-Pohlmann Tim-Pohlmann moved this from Validate Peach to Done in Best Kanban Mar 15, 2023
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. Area: VB.NET VB.NET rules related issues. Sprint: SE Short-lived* label for epic MMF-3077 *troll Type: CFG/SE FPs Rule IS triggered when it shouldn't be for CFG and SE rules.
Projects
Best Kanban
  
Done
Development

Successfully merging a pull request may close this issue.

4 participants