mirror of
https://github.com/github/codeql.git
synced 2026-04-28 18:25:24 +02:00
JS: rename UselessRangeCheck -> UselessComparisonTest
This commit is contained in:
@@ -27,14 +27,14 @@ If the check is needed to guard against <code>NaN</code> values, insert a commen
|
||||
The following example finds the index of an element in a given slice of the array:
|
||||
</p>
|
||||
|
||||
<sample src="examples/UselessRangeCheck.js" />
|
||||
<sample src="examples/UselessComparisonTest.js" />
|
||||
|
||||
<p>
|
||||
The condition <code>i < end</code> at the end is always false, however. The code can be clarified if the
|
||||
redundant condition is removed:
|
||||
</p>
|
||||
|
||||
<sample src="examples/UselessRangeCheckGood.js" />
|
||||
<sample src="examples/UselessComparisonTestGood.js" />
|
||||
|
||||
</example>
|
||||
<references>
|
||||
@@ -1,6 +1,7 @@
|
||||
/**
|
||||
* @name Useless range check
|
||||
* @description If a range check always fails or always succeeds, it is indicative of a bug.
|
||||
* @name Useless comparison test
|
||||
* @description A comparison that always evaluates to true or always evaluates to false may
|
||||
* indicate faulty logic and dead code.
|
||||
* @kind problem
|
||||
* @problem.severity warning
|
||||
* @id js/useless-range-check
|
||||
Reference in New Issue
Block a user