reference Flags

--max-chars-per-line

Accepted by
opengrep scan, opengrep ci
Value
INT
Default
160
See also
--max-lines-per-finding, --skin, --text, COLUMNS

A line of code longer than this is wrapped in the text output, and the rest is indented under it. The width of the terminal is an upper limit: a larger value does not make lines longer than the terminal.

The flag affects only the text output. The match is not affected, and the other formats contain the full line.

Examples

Wrapping a long line

rule.yaml
rules:  - id: find-eval    pattern: eval(...)    message: found eval    languages: [python]    severity: WARNING
long.py
eval(some_extremely_long_variable_name_here + "aaaa bbbb cccc dddd")
Command and result
$ opengrep scan -q --config rule.yaml --max-chars-per-line 60 long.py
long.py

  warn  find-eval
  found eval

     1: eval(some_extremely_long_variable_name_here + "aaaa bbbb cccc
        dddd")