reference Flags

--test

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

Runs the rule tests instead of scanning, as opengrep test does: each rule file is tested against the files named after it, and the # ruleid: and # ok: annotations are checked. The flag is accepted for compatibility.

Examples

Running the tests of a directory

find-eval.yaml
rules:  - id: find-eval    pattern: eval(...)    message: found eval    languages: [python]    severity: WARNING
find-eval.py
# ruleid: find-evaleval(1)# ok: find-evalevaluate(2)
Command and result
$ opengrep scan -q --test .
1/1: ✓ All tests passed
No tests for fixes found.