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

Create rule S6507 with "lock on local variable" check moved from S2445 #1608

Merged
merged 6 commits into from Mar 6, 2023

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Mar 3, 2023

You can preview this rule here (updated a few minutes after each push).

Kept in draft, to be merged together with SonarSource/sonar-dotnet#6854

@antonioaversa antonioaversa changed the title Create rule S6507 Create rule S6507 with "lock on local variable" check moved from S2445 Mar 3, 2023
@antonioaversa
Copy link
Contributor

"Build and Deploy / build-and-deploy (push)" GitHub check failures is not related to this PR, and is already present on master: https://github.com/SonarSource/rspec/actions/runs/4319582662/jobs/7538926037#step:3:132

Copy link
Contributor

@zsolt-kolbay-sonarsource zsolt-kolbay-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

=== is related to: S2445

=== on 3 Mar 2022, 10:46:00 Antonio Aversa wrote:
Rule spawn from the C# version of S2445, due to this branch of the rule generating a lot of FPs.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: spawn -> derived

=== is related to: S2445

=== on 3 Mar 2022, 10:46:00 Antonio Aversa wrote:
Rule derived from the C# version of S2445, due to this branch of the rule generating a lot of FPs.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe explain a bit more why this decision was taken.
It's not only for the FPs - this branch of the rule is still useful if indeed a local variable var local = new Object() for example is used, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, added a couple of paragraphs in my comment, with more details.

----
private void DoSomething()
{
object local;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
object local;
object local = new object();

should not compile otherwise.

Copy link
Contributor

@mary-georgiou-sonarsource mary-georgiou-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 - 2 nitpicks

@antonioaversa antonioaversa marked this pull request as ready for review March 6, 2023 10:50
@sonarsource-next
Copy link

SonarQube Quality Gate for 'rspec-frontend'

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

@sonarsource-next
Copy link

SonarQube Quality Gate for 'rspec-tools'

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

@antonioaversa antonioaversa merged commit 2cf782e into master Mar 6, 2023
@antonioaversa antonioaversa deleted the rule/add-RSPEC-S6507 branch March 6, 2023 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants