reference Flags

--emacs-output

Accepted by
opengrep scan, opengrep ci
Value
FILE
See also
--emacs, --output

Writes the lines that --emacs prints, one per finding, to FILE, in addition to the output on standard output. Emacs compilation-mode can read the file.

The flag can be repeated to write several files. The file is written even when the scan finds nothing; it is then empty.

Examples

A file for Emacs

rule.yaml
rules:  - id: find-eval    pattern: eval(...)    message: found eval    languages: [python]    severity: WARNING
app.py
eval(1)
Command and result
$ opengrep scan --config rule.yaml --emacs-output findings.txt app.py > /dev/null 2>&1
$ cat findings.txt
app.py:1:1:warning(find-eval):eval(1):found eval