Skip to content

Commit dded3af

Browse files
committed
remove more false positives from the ql/missing-parameter-qldoc query
1 parent 4b50c68 commit dded3af

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ private string getAMentionedNonParameter(Predicate p) {
4444
not result.toLowerCase() = getAParameterName(p).toLowerCase() and
4545
// keywords
4646
not result =
47-
["true", "false", "NaN", "this", "forall", "exists", "null", "break", "return", "not"] and
47+
[
48+
"true", "false", "NaN", "this", "forall", "exists", "null", "break", "return", "not", "if",
49+
"then", "else", "import"
50+
] and
4851
not result = any(Aggregate a).getKind() and // min, max, sum, count, etc.
4952
not result = getMentionedThings(p.getLocation().getFile()) and
5053
not result = any(Annotation a).getName() and // private, final, etc.
@@ -66,7 +69,7 @@ private string getMentionedThings(File file) {
6669
private string getAnUndocumentedParameter(Predicate p) {
6770
result = getAParameterName(p) and
6871
not result.toLowerCase() = getADocumentedParameter(p).toLowerCase() and
69-
not result = ["config", "conf", "cfg"] and // DataFlow configurations are often undocumented, and that's fine.
72+
not result = ["config", "conf", "cfg", "t", "t2"] and // DataFlow configurations / type-trackers are often undocumented, and that's fine.
7073
not (
7174
// "the given" often refers to the first parameter.
7275
p.getQLDoc().getContents().regexpMatch("(?s).*\\bthe given\\b.*") and
@@ -85,7 +88,7 @@ private string getMentionedNonParameters(Predicate p) {
8588
}
8689

8790
from Predicate p
88-
where not p.getLocation().getFile().getBaseName() = "Aliases.qll" // these are OK
91+
where not p.getLocation().getFile().getBaseName() in ["Aliases.qll", "TreeSitter.qll"] // these are OK
8992
select p,
9093
"The QLDoc has no documentation for " + getUndocumentedParameters(p) + ", but the QLDoc mentions "
9194
+ getMentionedNonParameters(p)

0 commit comments

Comments
 (0)