--max-target-bytes
- Accepted by
opengrep scan,opengrep ci- Value
VALUE, a number of bytes or a size such as1.5MB- Default
1000000- See also
--exclude-minified-files,--exclude,--max-memory
Files larger than this are not scanned. The default is 1,000,000 bytes. Zero or a negative value turns the limit off.
The value is a number of bytes, or a size with a unit, as in 1.5MB.
Like the other path filters, the limit applies to the files found under directory targets; a file named on the command line is scanned regardless of its size. The summary gives the number of skipped files, as in skipped: 1 files larger than 100 bytes.
Examples
Skipping a large file
rule.yaml
rules: - id: find-eval pattern: eval(...) message: found eval languages: [python] severity: WARNINGsrc/a.py
eval(1)Command and result
$ seq 500 | sed 's/.*/# pad/' > big.py && echo 'eval(1)' >> big.py
$ opengrep scan -q --config rule.yaml --files-with-matches .
big.py
src/a.py
$ opengrep scan -q --config rule.yaml --files-with-matches --max-target-bytes 100 .
src/a.py
$ opengrep scan -q --config rule.yaml --files-with-matches --max-target-bytes 100 big.py
big.pyThe last command scans big.py despite its size, because it was named on the command line.