-
Notifications
You must be signed in to change notification settings - Fork 30
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
Conversation
"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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
rules/S6507/comments-and-links.adoc
Outdated
=== 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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
rules/S6507/csharp/rule.adoc
Outdated
---- | ||
private void DoSomething() | ||
{ | ||
object local; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
object local; | |
object local = new object(); |
should not compile otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - 2 nitpicks
SonarQube Quality Gate for 'rspec-frontend' |
SonarQube Quality Gate for 'rspec-tools' |
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