JavaScript: Add new query UnusedIndexVariable.

This commit is contained in:
Max Schaefer
2019-09-09 17:01:21 +01:00
parent cdcc716675
commit 500cde68c3
17 changed files with 170 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
/**
* @name Unused index variable
* @description Iterating over an array but not using the index variable to access array elements
* may indicate a typo or logic error.
* @kind problem
* @problem.severity warning
* @id js/unused-index-variable
* @precision high
* @tags correctness
*/
import javascript
import UnusedIndexVariable
from RelationalComparison rel, Variable idx, Variable v
where unusedIndexVariable(rel, idx, v)
select rel, "Index variable " + idx + " is never used to access elements of " + v + "."