java:S125 False Positive

  • Operating system: Windows 10
  • SonarLint plugin version: 7.4.0.60471
  • Programming language you’re coding in: Java
  • Is connected mode used: No

The following comment is accusing S125: Remove commented code:

// If neither of the conditions for (1.1) or (1.3) are met, this
// ... continued comment block, S125 is in above line only

This is very clearly not legal Java code under any circumstances (or any other language that I know of, for that matter), so this is a false positive.

Hello @MarceloLaser,

Thanks for the feedback. You’re right this is indeed a false-positive. It happens because detecting if some line is a code or not is a complicated task. So we rely on a heuristic, which sometimes leads to such kind of false-positives.

Here is a ticket to track the issue:

https://sonarsource.atlassian.net/browse/SONARJAVA-4428

We’ll think about what we can do with it.

Regards,
Margarita

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