mirror of
https://github.com/github/codeql-action
synced 2026-05-23 20:00:54 +03:00
rename CLI to runner
This commit is contained in:
@@ -27,21 +27,21 @@ class ActionsLibImport extends ImportDeclaration {
|
||||
}
|
||||
|
||||
/**
|
||||
* An entrypoint to the CLI.
|
||||
* An entrypoint to the CodeQL runner.
|
||||
*/
|
||||
class ClIEntrypoint extends Function {
|
||||
ClIEntrypoint() {
|
||||
getFile().getAbsolutePath().matches("%/cli.ts")
|
||||
class RunnerEntrypoint extends Function {
|
||||
RunnerEntrypoint() {
|
||||
getFile().getAbsolutePath().matches("%/runner.ts")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A check of whether we are in actions mode or CLI mode.
|
||||
* A check of whether we are in actions mode or runner mode.
|
||||
*/
|
||||
class ModeGuard extends IfStmt {
|
||||
ModeGuard() {
|
||||
getCondition().(EqualityTest).getAnOperand().(StringLiteral).getValue() = "actions" or
|
||||
getCondition().(EqualityTest).getAnOperand().(StringLiteral).getValue() = "cli"
|
||||
getCondition().(EqualityTest).getAnOperand().(StringLiteral).getValue() = "runner"
|
||||
}
|
||||
|
||||
string getOperand() {
|
||||
@@ -58,11 +58,11 @@ class ModeGuard extends IfStmt {
|
||||
Stmt getActionsBlock() {
|
||||
(getOperand() = "actions" and isPositive() and result = getThen())
|
||||
or
|
||||
(getOperand() = "cli" and not isPositive() and result = getThen())
|
||||
(getOperand() = "runner" and not isPositive() and result = getThen())
|
||||
or
|
||||
(getOperand() = "actions" and not isPositive() and result = getElse())
|
||||
or
|
||||
(getOperand() = "cli" and isPositive() and result = getElse())
|
||||
(getOperand() = "runner" and isPositive() and result = getElse())
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,10 +99,10 @@ Function calledBy(Function f) {
|
||||
not exists(ModeGuard guard | guard.getAnActionsExpr() = result))
|
||||
}
|
||||
|
||||
from VarAccess v, ActionsLibImport actionsLib, ClIEntrypoint cliEntry
|
||||
from VarAccess v, ActionsLibImport actionsLib, RunnerEntrypoint runnerEntry
|
||||
where actionsLib.getAProvidedVariable() = v.getVariable()
|
||||
and getAFunctionChildExpr(calledBy*(cliEntry)) = v
|
||||
and getAFunctionChildExpr(calledBy*(runnerEntry)) = v
|
||||
select v, "$@ is imported from $@ and this code can be called from $@",
|
||||
v, v.getName(),
|
||||
actionsLib, actionsLib.getName(),
|
||||
cliEntry, "the CLI"
|
||||
runnerEntry, "the runner"
|
||||
|
||||
Reference in New Issue
Block a user