You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It complains that https://github.com/es-shims/es5-shim/blob/master/es5-shim.js#L2024 has no effect. However, in JavaScript, concatenating with a string has always had a potential effect - it invokes the operand's toString() method, which might have side effects and might throw. In this case, it's explicitly being used inside a try/catch to trigger an exception when the operand is a Symbol.
Thanks for your report. We deliberately flag code whose only potential effect looks unintentional, and the cases where a coercion happens for its side effects alone are so rare that it's best to clarify the intent with a suppression comment. I can see you've already done so for a few other tools, but unfortunately LGTM does not understand ESLint or jscs suppression comments.
So if you're willing to add yet another a suppression comment to your collection, it would look like this:
I'm not willing to add either, unfortunately; it might be wise for LGTM to add support for eslint suppression comments, since that's the defacto standard in the ecosystem.
In this specific case, however, since it's inside a try/catch, i don't think your heuristic should flag it.
The other issue you opened (#2621) has a try/catch surrounding the statement, and I'm considering how best to fix the FP there. There isn't a try/catch that will obviously catch the exception here.
Description of the false positive
It complains that https://github.com/es-shims/es5-shim/blob/master/es5-shim.js#L2024 has no effect. However, in JavaScript, concatenating with a string has always had a potential effect - it invokes the operand's
toString()
method, which might have side effects and might throw. In this case, it's explicitly being used inside a try/catch to trigger an exception when the operand is a Symbol.https://lgtm.com/projects/g/es-shims/es5-shim/snapshot/19e189f143ae56896a49a02c4edb02505310a1e3/files/es5-shim.js?sort=name&dir=ASC&mode=heatmap#x229e38c0aa84b3d4:1
The text was updated successfully, but these errors were encountered: