apply suggestions from code review

This commit is contained in:
Erik Krogh Kristensen
2022-01-04 13:42:30 +01:00
parent daed33f5af
commit 35c3c62f9e
2 changed files with 3 additions and 2 deletions

View File

@@ -14,7 +14,7 @@ import DataFlow::PathGraph
/**
* Gets the name of an unescaped placeholder in a lodash template.
*
* For example, the string "<h1><%= title %></h1>" contains the placeholder "title".
* For example, the string `"<h1><%= title %></h1>"` contains the placeholder "title".
*/
bindingset[s]
string getAPlaceholderInString(string s) {

View File

@@ -42,7 +42,8 @@ private string getAMentionedNonParameter(Predicate p) {
) and
result.regexpMatch("^[a-z]\\w+$") and
not result.toLowerCase() = getAParameterName(p).toLowerCase() and
not result = ["true", "false", "NaN", "this"] and // keywords
not result = ["true", "false", "NaN", "this", "forall", "exists", "null", "break", "return"] and // keywords
not result = any(Aggregate a).getKind() and // min, max, sum, count, etc.
not result = getMentionedPredicates(p.getLocation().getFile()) and
// variables inside the predicate are also fine
not result = any(VarDecl var | var.getEnclosingPredicate() = p).getName()