Rule S888 is not triggered if the loop termination condition uses !== instead of !=

Please provide

  • Operating system: Debian
  • SonarLint plugin version: v3.8.0
  • Is connected mode used: no
    • Connected to SonarCloud or SonarQube (and which version):

And a thorough description of the problem / question:

Hello! Thanks for a great product!

The documentation for rule javascript:S888 gives the following noncompliant example:

for (var i = 1; i != 10; i += 2)  // Noncompliant. Infinite; i goes from 9 straight to 11.
{
  //...
}

This does show the issue in VS Code, but if the condition is changed to i !== 10 (two equal signs), the issue is no longer shown.

Thanks!

Hello @ElRatonDeFuego ,

thanks for reporting this. Indeed this should be reported. I’ve opened an issue to track this.

Thanks!
Victor

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.