fix all ql/use-string-compare

This commit is contained in:
Erik Krogh Kristensen
2022-05-17 13:48:21 +02:00
parent 440e6214f0
commit 86e97c32d6
26 changed files with 62 additions and 61 deletions

View File

@@ -15,7 +15,7 @@ import javascript
from PropAccess acc, ArgumentsVariable args
where
acc.getBase() = args.getAnAccess() and
acc.getPropertyName().regexpMatch("caller|callee") and
acc.getPropertyName() = ["caller", "callee"] and
// don't flag cases where the variable can never contain an arguments object
not exists(Function fn | args = fn.getVariable()) and
not exists(Parameter p | args = p.getAVariable()) and

View File

@@ -50,8 +50,11 @@ from EqOrSwitch et, TypeofExpr typeof, ConstantString str
where
typeof = et.getAnOperand().getUnderlyingValue() and
str = et.getAnOperand().getUnderlyingValue() and
not str.getStringValue()
.regexpMatch("undefined|boolean|number|string|object|function|symbol|unknown|date|bigint")
not str.getStringValue() =
[
"undefined", "boolean", "number", "string", "object", "function", "symbol", "unknown", "date",
"bigint"
]
select typeof,
"The result of this 'typeof' expression is compared to '$@', but the two can never be equal.",
str, str.getStringValue()