reference Environment variables

OPENGREP_TIMEOUT

Also spelled
SEMGREP_TIMEOUT
Value
a number of seconds
Equivalent to
--timeout

The value of --timeout for opengrep scan and opengrep ci, used when the flag is not given. A value that is not a number is an error, and Opengrep exits with status 2.

Examples

The flag takes precedence

rule.yaml
rules:  - id: find-eval    pattern: eval(...)    message: found eval    languages: [python]    severity: WARNING
app.py
eval(code)
Command and result
$ OPENGREP_TIMEOUT=10 opengrep scan --config rule.yaml --timeout 20 app.py 2>&1 | grep WARNING
[00.04][WARNING]: --timeout is given; ignoring $OPENGREP_TIMEOUT

A value that is not a number

rule.yaml
rules:  - id: find-eval    pattern: eval(...)    message: found eval    languages: [python]    severity: WARNING
Command and result
$ OPENGREP_TIMEOUT=soon opengrep scan -q --config rule.yaml . 2> errors.txt; echo "exit status: $?"
exit status: 2
$ tail -2 errors.txt
opengrep scan: environment variable OPENGREP_TIMEOUT: invalid value "soon",
               expected a number