--exclude-rule
- Accepted by
opengrep scan,opengrep ci- Value
RULE_ID, repeatable
Removes the rule with this id from the scan. The flag can be repeated. It applies to rules from any source; the other rules of the source still run.
The id is the one reported in the findings. It includes the prefix that --config adds to the rules of a file in a subdirectory, as in rules.python.find-eval.
To suppress a finding on one line, use a nosem comment. To exclude some files from a rule, give the rule a paths key.
Examples
Running a config without one of its rules
rules.yaml
rules: - id: find-eval pattern: eval(...) message: found eval languages: [python] severity: WARNING - id: find-print pattern: print(...) message: found print languages: [python] severity: INFOapp.py
eval(1)print(2)Command and result
$ opengrep scan -q --config rules.yaml app.py
app.py
warn find-eval
found eval
1: eval(1)
info find-print
found print
2: print(2)
$ opengrep scan -q --config rules.yaml --exclude-rule find-print app.py
app.py
warn find-eval
found eval
1: eval(1)