--severity
- Accepted by
opengrep scan- Value
INFO,WARNINGorERROR, repeatable- See also
--exclude-rule,--error,--config,severity
Reports only the findings whose rule has one of the given severities. The flag can be repeated. Without it, the findings of all rules are reported.
The value is INFO, WARNING or ERROR, as in the severity of a rule. Any other value is rejected as an invalid flag value.
The flag filters the output; the other rules still run. To keep a rule from running, use --exclude-rule or give the rule a narrower paths.
Examples
Only the findings of severity ERROR
rules.yaml
rules: - id: high pattern: eval(...) message: eval found languages: [python] severity: ERROR - id: low pattern: print(...) message: print found languages: [python] severity: INFOapp.py
eval(1)print(2)Command and result
$ opengrep scan -q --config rules.yaml app.py
app.py
error high
eval found
1: eval(1)
info low
print found
2: print(2)
$ opengrep scan -q --config rules.yaml --severity ERROR app.py
app.py
error high
eval found
1: eval(1)