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

S1066: Add reproducer for #9221 #9264

Merged
merged 2 commits into from May 13, 2024
Merged

Conversation

CristianAmbrosini
Copy link
Contributor

Reproducer for #9221

@github-actions github-actions bot added this to In progress in Best Kanban May 9, 2024
@github-actions github-actions bot moved this from In progress to Review in progress in Best Kanban May 9, 2024
Copy link
Contributor

@sebastien-marichal sebastien-marichal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest adding more test cases.

Comment on lines 75 to 81
dynamic anything = "2024-04-29";

if (anything is string) // Secondary
if (DateTime.TryParseExact(anything, "yyyy-MM-dd", CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dt)) // Noncompliant FP
return dt;

return null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add more test cases based on what @pavel-mikula-sonarsource said about not raising if there is a dynamic in the statement:

if (notDynamic is not null)
  if (notDynamic == "something" && anything is string) // Noncompliant (not sure if FP or not there)
    return null;
    
if (notDynamic is not null)
  if (notDynamic == "something") // Noncompliant (to make sure we do not deactivate S1066 for the whole block)
    return null;

@github-actions github-actions bot moved this from Review in progress to In progress in Best Kanban May 13, 2024
Copy link

sonarcloud bot commented May 13, 2024

Quality Gate Passed Quality Gate passed for 'Sonar .NET Java Plugin'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@github-actions github-actions bot moved this from In progress to Review in progress in Best Kanban May 13, 2024
Copy link

sonarcloud bot commented May 13, 2024

Quality Gate Passed Quality Gate passed for 'SonarAnalyzer for .NET'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Contributor

@sebastien-marichal sebastien-marichal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@sebastien-marichal sebastien-marichal merged commit 37ebbed into master May 13, 2024
28 checks passed
Best Kanban automation moved this from Review in progress to Validate Peach May 13, 2024
@sebastien-marichal sebastien-marichal deleted the cristian/repro-9221 branch May 13, 2024 15:01
@CristianAmbrosini CristianAmbrosini moved this from Validate Peach to Done in Best Kanban May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Best Kanban
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants