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 S3267 FN: Support list pattern #6414

Merged
merged 9 commits into from
Dec 6, 2022
Merged

Conversation

gregory-paidis-sonarsource
Copy link
Contributor

Fixes #6387

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good! I just left a few comments for minor stuff

Copy link
Contributor

Choose a reason for hiding this comment

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

Last indentation comment

analyzers/src/SonarAnalyzer.CSharp/Rules/LoopsAndLinq.cs Outdated Show resolved Hide resolved
foreach (var array in list) // Compliant, do not raise on var pattern in ListPattern
{
if (array is [1, var x, var z])
{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Following up on the previous comment, if someone re-wrote this as a Linq Where, the x and y variables would not be properly scoped inside the if statement. Same with is ... local

Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@csaba-sagi-sonarsource csaba-sagi-sonarsource left a comment

Choose a reason for hiding this comment

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

Nice work! Only a bit more left and it can be merged.

Copy link
Contributor

@csaba-sagi-sonarsource csaba-sagi-sonarsource left a comment

Choose a reason for hiding this comment

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

One last round of comments.

Copy link
Contributor

@csaba-sagi-sonarsource csaba-sagi-sonarsource left a comment

Choose a reason for hiding this comment

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

Last change requested, promise :)

@sonarcloud
Copy link

sonarcloud bot commented Dec 1, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@sonarcloud
Copy link

sonarcloud bot commented Dec 1, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

Copy link
Contributor

@csaba-sagi-sonarsource csaba-sagi-sonarsource left a comment

Choose a reason for hiding this comment

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

LGTM!

@csaba-sagi-sonarsource csaba-sagi-sonarsource marked this pull request as draft December 2, 2022 15:41
@csaba-sagi-sonarsource csaba-sagi-sonarsource marked this pull request as ready for review December 6, 2022 09:30
@csaba-sagi-sonarsource csaba-sagi-sonarsource merged commit fb23659 into master Dec 6, 2022
@csaba-sagi-sonarsource csaba-sagi-sonarsource deleted the greg/fix-S3267-FN branch December 6, 2022 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix S3267 FN: Support list pattern
3 participants