reference Flags

--validate

Accepted by
opengrep scan
See also
opengrep validate, --test, --config

Checks the rules given with --config instead of scanning, and prints the same result as opengrep validate. The flag is accepted for compatibility. opengrep validate takes the rule files as arguments instead of --config.

Examples

Checking a rule file

rule.yaml
rules:  - id: find-eval    pattern: eval(...)    message: found eval    languages: [python]    severity: WARNING
Command and result
$ opengrep scan --validate --config rule.yaml 2>&1
1 file · 6 rules

Configuration is valid - found 0 fatal errors, 0 skippable error(s), and 1 rule(s).
$ opengrep validate rule.yaml 2>&1
1 file · 6 rules

Configuration is valid - found 0 fatal errors, 0 skippable error(s), and 1 rule(s).