reference Flags

--max-lines-per-finding

Accepted by
opengrep scan, opengrep ci
Value
INT
Default
10
See also
--max-chars-per-line, --skin, --max-log-list-entries, --text

A finding that spans more lines than this is shortened in the text output, and a line that gives the number of omitted lines takes the place of the rest. 0 shows every line of the match. The flag affects only the text output; the other formats contain the whole match.

Examples

Trimming a match that spans several lines

rule.yaml
rules:  - id: eval-call    pattern: eval($X)    message: found eval of $X    languages: [python]    severity: WARNING
app.py
eval(  1)
Command and result
$ opengrep scan -q --config rule.yaml app.py
app.py

  warn  eval-call
  found eval of 1

     1: eval(
     2:   1
     3: )
$ opengrep scan -q --config rule.yaml --max-lines-per-finding 1 app.py
app.py

  warn  eval-call
  found eval of 1

     1: eval(
    … 2 lines more, adjust with --max-lines-per-finding