CLI-11: Command guards and actions
A finding of CLI-11 means that a guard or an action of type: command can’t run as written. The rules page says what the rule checks.
Messages
<file>:<line>: error: <path>.params.run: run must be a string (shell) or a list of strings (no shell) (CLI-11)
<file>:<line>: error: <path>: command run is empty (CLI-11)
<file>:<line>: error: <path>: command run is an empty list (CLI-11)
<file>:<line>: error: <path>: timeoutSecs must be at least 1 (CLI-11)
<file>:<line>: warning: <path>: a list-form run gets no shell, so nothing expands $SMLLM_*. Use the string form, or read the environment in a script (CLI-11)
Cause
Each message has its own cause, and smllm validate lists the last, a warning, only with --warnings:
runis neither a string nor a list of strings, such as a number or a list that holds a number.runis an empty string, or a string of spaces.runis an empty list.timeoutSecsis 0.runis a list, and one of its items contains$SMLLM_. smllm runs a list without a shell, so the program gets the text$SMLLM_REFitself, not the value of the variable.
Fix
Fix each message in the order of the causes:
- Write
runas a string, which a shell runs, or as a list of strings: the program, then its arguments. - Give
runthe command to run. - Give
runat least the program to run. - Set
timeoutSecsto 1 or more, or remove it for the default of 60 seconds. - Write
runas a string, so that the shell expands the variables, or run a script that reads them from its environment. On Windows,cmdwrites a variable as%SMLLM_REF%.
Example
The command of DONE passes the ref of the instance in a list, where no shell expands $SMLLM_REF:
.smllm/fix.smllm.yaml
id: fix
initial: TRIAGE
meta:
smllm: 1
states:
TRIAGE:
on:
reproduced: DONE
DONE:
type: final
entry: { type: command, params: { run: [git, commit, -am, "Fix $SMLLM_REF"] } }
smllm validate --warnings reports the list:
$ smllm validate --warnings .smllm/fix.smllm.yaml
.smllm/fix.smllm.yaml:11: warning: states.DONE.entry: a list-form run gets no shell, so nothing expands $SMLLM_*. Use the string form, or read the environment in a script (CLI-11)
0 errors, 1 warning, 0 info
The fixed command is a string, which a shell runs:
.smllm/fix.smllm.yaml
id: fix
initial: TRIAGE
meta:
smllm: 1
states:
TRIAGE:
on:
reproduced: DONE
DONE:
type: final
entry: { type: command, params: { run: 'git commit -am "Fix $SMLLM_REF"' } }
smllm validate reports no finding:
$ smllm validate --warnings .smllm/fix.smllm.yaml
0 errors, 0 warnings, 0 info