Skip to content

Commit fffb034

Browse files
Apply suggestions from code review
Co-authored-by: Koen Vlaswinkel <koesie10@users.noreply.github.com>
1 parent 84df4b6 commit fffb034

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

.github/codeql/queries/ProgressBar.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ abstract class ProgressBar extends CallExpr {
77

88
abstract ObjectExpr getOptions();
99

10-
predicate usesToken() { this.getCallback().getNumParameter() >= 2 }
10+
predicate usesToken() { exists(this.getTokenParameter()) }
11+
12+
Parameter getTokenParameter() { result = this.getCallback().getParameter(1) }
1113

1214
Property getCancellableProperty() { result = this.getOptions().getPropertyByName("cancellable") }
1315

.github/codeql/queries/progress-not-cancellable.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@ import ProgressBar
1414

1515
from ProgressBar t
1616
where not t.isCancellable() and t.usesToken()
17-
select t, "The token should not be used when the progress bar is not cancelable. Either stop using the token or mark the progress bar as cancellable."
17+
select t,
18+
"The $@ should not be used when the progress bar is not cancellable. Either stop using the $@ or mark the progress bar as cancellable.",
19+
t.getTokenParameter(), t.getTokenParameter().getName(), t.getTokenParameter(),
20+
t.getTokenParameter().getName()

.github/codeql/queries/token-not-used.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @name Don't ignore the token for a cancelable progress bar
2+
* @name Don't ignore the token for a cancellable progress bar
33
* @kind problem
44
* @problem.severity warning
55
* @id vscode-codeql/token-not-used

0 commit comments

Comments
 (0)