reference Flags

--opengrep-ignore-pattern

Accepted by
opengrep scan, opengrep ci, opengrep test
Value
PREFIX
See also
--enable-nosem, --exclude-rule, --sarif-output

A comment that starts with nosem, nosemgrep or noopengrep, at the end of a line, suppresses the findings on that line. This flag adds another prefix.

The three built-in prefixes remain in effect. --disable-nosem turns off all such comments. To skip a rule everywhere instead of on one line, see --exclude-rule.

Examples

The marker of another tool

rule.yaml
rules:  - id: find-eval    pattern: eval(...)    message: found eval    languages: [python]    severity: WARNING
app.py
eval(1)  # nosemeval(2)  # noscaneval(3)
Command and result
$ opengrep scan -q --config rule.yaml app.py
app.py

  warn  find-eval
  found eval

     2: eval(2)  # noscan

     3: eval(3)
$ opengrep scan -q --config rule.yaml --opengrep-ignore-pattern=noscan app.py
app.py

  warn  find-eval
  found eval

     3: eval(3)

The finding on line 1 is suppressed in both runs, since nosem is a built-in prefix.