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

Repro for FP S2589: Assignment for captures are ignored #9205

Merged
merged 5 commits into from
Apr 26, 2024

Conversation

martin-strecker-sonarsource
Copy link
Contributor

Repro for #9204
Repro for #8885

@github-actions github-actions bot added this to In progress in Best Kanban Apr 25, 2024
@martin-strecker-sonarsource martin-strecker-sonarsource marked this pull request as ready for review April 25, 2024 10:13
Copy link
Contributor

@Tim-Pohlmann Tim-Pohlmann left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 4264 to 4275
public bool LocalFunctionTest()
{
var found = false;
Assign();
if (!found) // Noncompliant FP
{
Console.WriteLine("No License for artifact type");
}
return found;

void Assign() => found = true; // Assignment in local function
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a duplicate of #8885. But #8885 doesn't seem to have a reproducer. So I guess it's good that we keep it. But link it via comment to the the ticket please.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a reproducer for #8885 as well.

@github-actions github-actions bot moved this from In progress to Review approved in Best Kanban Apr 25, 2024
Copy link

sonarcloud bot commented Apr 25, 2024

Quality Gate Passed Quality Gate passed for '.NET Analyzers parent'

Issues
0 New issues
0 Accepted issues

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

See analysis details on SonarCloud

Copy link

sonarcloud bot commented Apr 25, 2024

@github-actions github-actions bot moved this from Review approved to Review in progress in Best Kanban Apr 25, 2024
@@ -57,7 +57,9 @@ public class ConditionEvaluatesToConstantTest
[DataRow(ProjectType.Test)]
public void ConditionEvaluatesToConstant_Roslyn_CS(ProjectType projectType) =>
roslynCS.AddPaths("ConditionEvaluatesToConstant.cs")
.AddReferences(NuGetMetadataReference.MicrosoftExtensionsPrimitives("3.1.7").Concat(TestHelper.ProjectTypeReference(projectType)))
.AddReferences(NuGetMetadataReference.MicrosoftExtensionsPrimitives("3.1.7"))
.AddReferences(MetadataReferenceFacade.SystemComponentModelTypeConverter)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For System.Timers.Timer

Copy link
Contributor

@Tim-Pohlmann Tim-Pohlmann left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions github-actions bot moved this from Review in progress to Review approved in Best Kanban Apr 25, 2024
@martin-strecker-sonarsource martin-strecker-sonarsource merged commit f98e532 into master Apr 26, 2024
31 checks passed
Best Kanban automation moved this from Review approved to Validate Peach Apr 26, 2024
@martin-strecker-sonarsource martin-strecker-sonarsource deleted the Martin/Repro_9204 branch April 26, 2024 11:46
@martin-strecker-sonarsource martin-strecker-sonarsource moved this from Validate Peach to Done in Best Kanban Apr 29, 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