Apply suggestions from code review
Co-authored-by: Koen Vlaswinkel <koesie10@users.noreply.github.com>
This commit is contained in:
Родитель
84df4b64d8
Коммит
fffb0349a6
|
@ -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") }
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче