mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
JS: whitelist js/unused-local-variable near direct eval calls
This commit is contained in:
@@ -156,6 +156,12 @@ predicate whitelisted(UnusedLocal v) {
|
||||
isEnumMember(vd) or
|
||||
// ignore ambient declarations - too noisy
|
||||
vd.isAmbient()
|
||||
) or
|
||||
exists (DirectEval eval |
|
||||
// eval nearby
|
||||
eval.getEnclosingFunction() = v.getADeclaration().getEnclosingFunction() and
|
||||
// ... but not on the RHS
|
||||
not v.getAnAssignedExpr() = eval
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
| decorated.ts:1:1:1:126 | import ... where'; | Unused import actionHandler. |
|
||||
| decorated.ts:4:10:4:12 | fun | Unused function fun. |
|
||||
| eval.js:2:9:2:20 | used_by_eval | Unused variable used_by_eval. |
|
||||
| eval.js:7:9:7:20 | used_by_eval | Unused variable used_by_eval. |
|
||||
| eval.js:10:9:10:24 | not_used_by_eval | Unused variable not_used_by_eval. |
|
||||
| eval.js:19:9:19:24 | not_used_by_eval | Unused variable not_used_by_eval. |
|
||||
| externs.js:6:5:6:13 | iAmUnused | Unused variable iAmUnused. |
|
||||
|
||||
Reference in New Issue
Block a user