--rewrite-rule-ids
- Accepted by
opengrep scan,opengrep ci- Also spelled
--no-rewrite-rule-ids- Default
true- See also
--config,--exclude-rule,id
When a rule file is in a subdirectory of the current directory, Opengrep prefixes the ids of its rules with the path of that directory, with dots in place of the slashes: the rule find-eval in rules/eval.yaml is reported as rules.find-eval. Rules in different files can then have the same id, and the id of a finding shows where its rule is defined. This is the default.
--no-rewrite-rule-ids keeps the ids as written in the rule files.
--exclude-rule takes the ids as reported, with the prefix.
Examples
An id with and without its path
rules/eval.yaml
rules: - id: find-eval pattern: eval(...) message: found eval languages: [python] severity: WARNINGapp.py
eval(1)Command and result
$ opengrep scan -q --config rules/ app.py
app.py
warn rules.find-eval
found eval
1: eval(1)
$ opengrep scan -q --config rules/ --no-rewrite-rule-ids app.py
app.py
warn find-eval
found eval
1: eval(1)