big refactor of UselessUseOfCal

This commit is contained in:
Erik Krogh Kristensen
2020-02-21 14:26:42 +01:00
parent 6ea14532ab
commit 75410e5760
5 changed files with 249 additions and 142 deletions

View File

@@ -15,5 +15,9 @@ import semmle.javascript.security.UselessUseOfCat
import semmle.javascript.RestrictedLocations
from UselessCat cat
select cat.asExpr().(FirstLineOf), "Useless use of `cat`. Can be replaced with: " + createReadFileCall(cat)
from UselessCat cat, string message
where
message = " Can be replaced with: " + PrettyPrintCatCall::createReadFileCall(cat)
or
not exists(PrettyPrintCatCall::createReadFileCall(cat)) and message = ""
select cat.asExpr().(FirstLineOf), "Useless use of `cat`." + message