reference Environment variables

OPENGREP_SUPPRESS_ERRORS

Also spelled
SEMGREP_SUPPRESS_ERRORS
Value
true, yes, 1 or false, no, 0
Equivalent to
--suppress-errors

Read by opengrep ci when neither --suppress-errors nor --no-suppress-errors is given. A true value keeps the default, in which an error ends the run with exit status 0. A false value keeps the original exit status, so that, for example, an invalid rule file fails the job.

The accepted values are true, TRUE, yes and 1 for true, and false, FALSE, no and 0 for false. Any other value, including on and off, is rejected like an invalid flag value, and opengrep ci exits with status 2.

Examples

Failing the job on an invalid rule file

broken.yaml
rules:  - id: broken    patterns:      - pattern-not: eval("...")    message: a rule that cannot work    languages: [python]    severity: WARNING
app.py
eval(1)
Command and result
$ git init -q && git add . && git commit -qm init
$ opengrep ci --config broken.yaml > /dev/null 2>&1; echo "exit status: $?"
exit status: 0
$ OPENGREP_SUPPRESS_ERRORS=false opengrep ci --config broken.yaml > /dev/null 2>&1; echo "exit status: $?"
exit status: 7
$ OPENGREP_SUPPRESS_ERRORS=off opengrep ci --config broken.yaml > /dev/null 2>&1; echo "exit status: $?"
exit status: 2