Hey @pcolmer
As noted in the thread on how to report a false-positive, can you tell us what product you’re using and, if relevant, which version?
In any case, I think you are probably reporting this known false-positive which you can track on GitHub: FP on S2189 when loop condition variables are modified through function calls · Issue #2866 · SonarSource/SonarJS · GitHub