Skip to content

Commit 86c8737

Browse files
committed
remove string constants from mentioned non-params
1 parent 35c3c62 commit 86c8737

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ql/ql/src/queries/style/MissingParameterInQlDoc.ql

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,18 @@ private string getAMentionedNonParameter(Predicate p) {
4444
not result.toLowerCase() = getAParameterName(p).toLowerCase() and
4545
not result = ["true", "false", "NaN", "this", "forall", "exists", "null", "break", "return"] and // keywords
4646
not result = any(Aggregate a).getKind() and // min, max, sum, count, etc.
47-
not result = getMentionedPredicates(p.getLocation().getFile()) and
47+
not result = getMentionedThings(p.getLocation().getFile()) and
4848
// variables inside the predicate are also fine
4949
not result = any(VarDecl var | var.getEnclosingPredicate() = p).getName()
5050
}
5151

52-
/** Gets the names of all predicates that are mentioned in `file`. */
52+
/** Gets the names of all predicates and string constants that are mentioned in `file`. */
5353
pragma[noinline]
54-
private string getMentionedPredicates(File file) {
54+
private string getMentionedThings(File file) {
5555
// predicates get mentioned all the time, it's fine.
5656
result = any(Predicate pred | pred.getLocation().getFile() = file).getName() or
57-
result = any(Call c | c.getLocation().getFile() = file).getTarget().getName()
57+
result = any(Call c | c.getLocation().getFile() = file).getTarget().getName() or
58+
result = any(String s | s.getLocation().getFile() = file).getValue()
5859
}
5960

6061
/** Gets a parameter name from `p` that is not mentioned in the qldoc. */

0 commit comments

Comments
 (0)