reference Environment variables
COLUMNS
- Value
- a positive whole number
- See also
--max-chars-per-line,--skin
The width, in characters, for which the text output is laid out. Opengrep uses COLUMNS when it holds a positive integer, and the width of the terminal otherwise. The width is kept between 40 and 120: a smaller value is treated as 40, and a larger one as 120. Output to a pipe or a file, without COLUMNS, is laid out for 120 characters.
The width determines where long lines of code wrap, and the length of the horizontal rules of the vivid skin. It affects only the text output. The variable has no OPENGREP_ form.
Examples
A narrow report
rule.yaml
rules: - id: find-eval pattern: eval(...) message: found eval languages: [python] severity: WARNINGlong.py
eval(some_extremely_long_variable_name_for_wrapping + other_long_name_here + more)Command and result
$ COLUMNS=40 opengrep scan -q --config rule.yaml long.py
long.py
warn find-eval
found eval
1: eval(some_extremely_long_variable_
name_for_wrapping +
other_long_name_here + more)
$ diff <(COLUMNS=20 opengrep scan --config rule.yaml long.py) <(COLUMNS=40 opengrep scan --config rule.yaml long.py) > /dev/null && echo same
sameA width of 20 is below the minimum, so the output is the same as with 40.