reference Environment variables
OPENGREP_BASELINE_REF
- Also spelled
SEMGREP_BASELINE_REF- Value
- a git revision
- Equivalent to
--baseline-commit- See also
OPENGREP_BASELINE_COMMIT
An alternative name for OPENGREP_BASELINE_COMMIT. It is read only when neither OPENGREP_BASELINE_COMMIT nor SEMGREP_BASELINE_COMMIT is set. --baseline-commit takes precedence over it.
Examples
Precedence between the two names
rule.yaml
rules: - id: no-print pattern: print(...) message: use logging instead of print languages: [python] severity: INFOa.py
print("old")Command and result
$ git init -q && git add . && git commit -qm one
$ echo 'print("new")' > b.py && git add b.py && git commit -qm two
$ OPENGREP_BASELINE_REF=HEAD~1 opengrep scan -q --config rule.yaml --files-with-matches .
b.py
$ OPENGREP_BASELINE_COMMIT=HEAD OPENGREP_BASELINE_REF=HEAD~1 opengrep scan -q --config rule.yaml --files-with-matches .The last command prints nothing: OPENGREP_BASELINE_COMMIT takes precedence, and there are no new findings relative to HEAD.