reference Flags

--semgrepignore-filename

Accepted by
opengrep scan
Value
FILENAME
Default
.semgrepignore
See also
--exclude, --use-git-ignore, --project-root

Opengrep skips the paths listed in .semgrepignore at the project root. This flag reads the list from FILENAME instead.

The file uses the pattern syntax of .gitignore. When the project has no such file, a built-in list applies, which skips directories such as node_modules/, vendor/, test/ and tests/. The project root is set by --project-root.

Examples

An ignore list under another name

rule.yaml
rules:  - id: find-eval    pattern: eval(...)    message: found eval    languages: [python]    severity: WARNING
src/a.py
eval(1)
mystuff/m.py
eval(2)
.myignore
mystuff/
Command and result
$ opengrep scan -q --config rule.yaml --files-with-matches .
mystuff/m.py
src/a.py
$ opengrep scan -q --config rule.yaml --files-with-matches --semgrepignore-filename .myignore .
src/a.py