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

Add C# 9 test cases (8 rules) #3698

Merged
merged 10 commits into from
Nov 2, 2020
Merged

Conversation

costin-zaharia-sonarsource
Copy link
Member

Related to #3668

Base automatically changed from costin/cs9-uts-1 to master November 2, 2020 08:29
@costin-zaharia-sonarsource costin-zaharia-sonarsource changed the title Add C# 9 test cases Add C# 9 test cases (8 rules) Nov 2, 2020
@costin-zaharia-sonarsource costin-zaharia-sonarsource marked this pull request as ready for review November 2, 2020 10:05
Copy link
Contributor

@andrei-epure-sonarsource andrei-epure-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, I've left 2 comments

@@ -0,0 +1,73 @@
using System;

int a = 0; // Compliant - FN
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 local variable in the main method - why is this an FN?

same for line 8

Copy link
Member Author

Choose a reason for hiding this comment

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

My bad. It's not.

new R().MyMethod();
i = new R().MyMethod2();

int NeverUsed(int neverUsedVal) // FN - the returned value is not used
Copy link
Contributor

Choose a reason for hiding this comment

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

does this work for local functions in C# 7?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, we have a few test cases with local functions and static local functions and the analysis works as expected. It seems we have issues only with local functions defined as top level statements.

@sonarcloud
Copy link

sonarcloud bot commented Nov 2, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

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

@sonarcloud
Copy link

sonarcloud bot commented Nov 2, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@costin-zaharia-sonarsource costin-zaharia-sonarsource merged commit e4351a7 into master Nov 2, 2020
@costin-zaharia-sonarsource costin-zaharia-sonarsource deleted the costin/cs9-uts-2 branch November 2, 2020 14:03
Corniel pushed a commit to Corniel/sonar-csharp that referenced this pull request Nov 30, 2020
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.

2 participants