--timeout-threshold
- Accepted by
opengrep scan,opengrep ci,opengrep test- Value
INT- See also
--timeout,--max-memory,--strict
When a rule exceeds its --timeout on a file, Opengrep drops the findings of that rule on the file and continues with the other rules.
After this many rules have timed out on a file, Opengrep runs no further rules on it, logs a message on standard error, and counts the file as partially analyzed. 0 removes the limit, so every rule runs regardless of the number of timeouts.
Examples
Skipping a file after one timeout
slow.yaml
rules: - id: slow-a patterns: - pattern: $F(..., $X, ...) + $G(..., $Y, ...) - pattern-not: $F($X, $X, ...) + $G(...) message: slow a languages: [python] severity: INFOCommand and result
$ seq 20000 | sed 's/.*/x& = f(a, b, c) + g(d, e) + h(&)/' > big.py
$ opengrep scan --config slow.yaml --timeout 0.001 --timeout-threshold 1 big.py 2>&1 >/dev/null | grep 'stopped running'
Opengrep stopped running rules on big.py after 1 timeout error(s). See `--timeout-threshold` for more info.