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

Fix FP S2189 ('no-infinite-loop'): Ignore condition variables called on or passed over #2866

Closed
yassin-kammoun-sonarsource opened this issue Nov 9, 2021 · 0 comments · Fixed by #3455
Assignees
Labels
type: false positive Issue is reported when it should NOT be
Milestone

Comments

@yassin-kammoun-sonarsource
Copy link
Contributor

We are currently raising false positives on variables of loop conditions that could possibly be subject to mutation through function and methods calls:

let foo = { /* ... */ };
while (foo) { // FP
  foo.doSomething(); // `doSomething` could modify `foo`
}

We should assume that such variables are always modified in order to kill the noise.

Reported in https://community.sonarsource.com/t/l3989-false-positive-in-loopsshouldnotbeinfinitecheck-should-support-guard-clause

@yassin-kammoun-sonarsource yassin-kammoun-sonarsource added the type: false positive Issue is reported when it should NOT be label Nov 9, 2021
@yassin-kammoun-sonarsource yassin-kammoun-sonarsource added this to the 9.9 milestone Sep 30, 2022
@victor-diez-sonarsource victor-diez-sonarsource removed their assignment Oct 4, 2022
@yassin-kammoun-sonarsource yassin-kammoun-sonarsource changed the title FP on S2189 when loop condition variables are modified through function calls Fix FP S2189 ('no-infinite-loop'): Ignore condition variables called on or passed over Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: false positive Issue is reported when it should NOT be
Projects
None yet
3 participants