Skip to content

LGTM.com - false positives: Useless comparison test #2234

@kno10

Description

@kno10

I see multiple false positives with this rule.

Apparently your parser fails to work correctly with ternary statements (I see many such false positives) or values that are tested multiple times in sequence. Yes, many people hat ternary expressions. But in hot code they can make a difference, and here maintenance is working fine. Its not as if boundary conditions in mathematics are going to change often.

https://lgtm.com/projects/g/elki-project/elki/snapshot/166e040796eaaf504872fe8869f4b45c0dc1776f/files/elki-core-math/src/main/java/elki/math/statistics/distribution/BetaDistribution.java#x43dfd0e3ba8863fe:1
https://lgtm.com/projects/g/elki-project/elki/snapshot/166e040796eaaf504872fe8869f4b45c0dc1776f/files/elki-core-math/src/main/java/elki/math/statistics/distribution/GammaDistribution.java#x8504d322f492f8ce:1
https://lgtm.com/projects/g/elki-project/elki/snapshot/166e040796eaaf504872fe8869f4b45c0dc1776f/files/elki-core-math/src/main/java/elki/math/statistics/distribution/GammaDistribution.java?sort=name&dir=ASC&mode=heatmap#xc1cdd586f50c276b:1
https://lgtm.com/projects/g/elki-project/elki/snapshot
/166e040796eaaf504872fe8869f4b45c0dc1776f/files/elki-core-math/src/main/java/elki/math/statistics/distribution/NormalDistribution.java?sort=name&dir=ASC&mode=heatmap#xa80c9b4c2e406404:1

This is different kind of false positive:
https://lgtm.com/projects/g/elki-project/elki/snapshot/166e040796eaaf504872fe8869f4b45c0dc1776f/files/elki-core-util/src/main/java/elki/utilities/datastructures/heap/Heap.java?sort=name&dir=ASC&mode=heatmap#x48a6e9c192ca5d50:1
which detects numeric overflow of int.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions