Apply suggestions from code review

Co-authored-by: Koen Vlaswinkel <koesie10@users.noreply.github.com>
This commit is contained in:
Robert
2024-03-14 13:33:06 +00:00
committed by GitHub
parent 84df4b64d8
commit fffb0349a6
3 changed files with 8 additions and 3 deletions

View File

@@ -7,7 +7,9 @@ abstract class ProgressBar extends CallExpr {
abstract ObjectExpr getOptions();
predicate usesToken() { this.getCallback().getNumParameter() >= 2 }
predicate usesToken() { exists(this.getTokenParameter()) }
Parameter getTokenParameter() { result = this.getCallback().getParameter(1) }
Property getCancellableProperty() { result = this.getOptions().getPropertyByName("cancellable") }

View File

@@ -14,4 +14,7 @@ import ProgressBar
from ProgressBar t
where not t.isCancellable() and t.usesToken()
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."
select t,
"The $@ should not be used when the progress bar is not cancellable. Either stop using the $@ or mark the progress bar as cancellable.",
t.getTokenParameter(), t.getTokenParameter().getName(), t.getTokenParameter(),
t.getTokenParameter().getName()

View File

@@ -1,5 +1,5 @@
/**
* @name Don't ignore the token for a cancelable progress bar
* @name Don't ignore the token for a cancellable progress bar
* @kind problem
* @problem.severity warning
* @id vscode-codeql/token-not-used