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

Update S1226: Change contract of the rule to make it become more relevant #630

Closed
fmallet opened this issue Aug 1, 2017 · 3 comments
Closed

Comments

@fmallet
Copy link
Contributor

fmallet commented Aug 1, 2017

This rule currently triggers an issue as soon as a method parameter is reassigned. With updated RSPEC-1226 this rule is supposed to raise an issue if an only if a method parameter, caught exception or foreach variable is reassigned without having been read before.

To be noted that this rule must be part of Sonar way and becomes a bug detection rule.

Moreover, rule RSPEC-3316 should also be updated to stop spotting such kind of issues.

@fmallet fmallet added this to the 6.4 milestone Aug 1, 2017
@Evangelink Evangelink changed the title Change contract of rule S1226 to make it become more relevant Update S1226: Change contract of the rule to make it become more relevant Aug 2, 2017
@Evangelink Evangelink modified the milestones: 6.5, 6.4 Aug 17, 2017
@Evangelink Evangelink removed this from the 6.5 milestone Oct 4, 2017
@Evangelink Evangelink added this to the Rules milestone Aug 9, 2018
@rymeskar
Copy link

Any news regarding this issue @fmallet and @Evangelink ?

The initial intent of the rule is quite right and preventing one family of bugs.

However, the implementation seems to be triggering even in cases where it should not.

Example is linked list traversal:
while (e != null) { list.Add(FormatMessage(e)); e = e.InnerException; }

@valhristov
Copy link
Contributor

Hi @rymeskar, I created a new ticket from your comment. I am closing this one, as it was implemented but forgotten to be closed.

@andrei-epure-sonarsource
Copy link
Contributor

Hi @rymeskar . I'm trying to reproduce the issue you reported here (for ticket #2249) and, from what I see, this has been fixed in #1712 (so included in 7.4.0.6452).

What version of the SonarAnalyzer are you using?

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

No branches or pull requests

5 participants