[javascript:S3800] FP when working on prototype function

Qube: Community 9.9

The Javascript rule S3800 reports a FP, when implementing a prototype function and returning this.

String.prototype.foo = function()
{
    if (this.length == 10)
        return this.substring(5);
    
    return this;
}

Hello @mfroehlich,

Many thanks for your feedback!

I managed to reproduce the false-positive with the code snippet you shared not only on SonarQube 9.9 but also on the latest version of the analyzer.

I created this ticket to fix this. In the meantime, you can just mark such an issue on SonarQube as a false-positive.

Hope this helps,
Yassin

Thanks!

This leads me to a not totally related question:

If I mark something in Qube as FP and a future version of the analyzer doesn’t raise an issue, is the mark removed then?