After running uncrustify I want no line to be longer than, say, 80 characters. How do I set the maximum length of a line in the uncrustify config file?
Asked
Active
Viewed 1,342 times
1 Answers
2
Add a section like this to your config file. It does not guarantee to get all lines below the specified width.
#
# Line Splitting options
#
code_width 80
# Unsigned Number
# Try to limit code width to N number of columns
ls_for_split_full True
# { False, True }
# Whether to fully split long 'for' statements at semi-colons.
ls_func_split_full True
# { False, True }
# Whether to fully split long function protos/calls at commas.
ls_code_width True
# { False, True }
# Whether to split lines as close to code_width as possible and ignore some groupings.

ColonelFazackerley
- 909
- 6
- 17
-
"It does not guarantee to get all lines below the specified width." In what situations can it not meet that limit? If it cannot, what is its behavior? Also, I am assuming that splitting ```for``` and functions only happens if it exceeds the limit set by ```code_width```, right? If it is not, set, they do nothing? Also, can the way it splits them be configured? I know that varies quite a bit depending on the style adhered to. – Tyler Shellberg Oct 30 '19 at 17:13
-
That caveat is from the uncrustify docs. At the time (a year ago), I could not find more info. I did not go the the lengths of reading the uncrustify source code. – ColonelFazackerley Oct 31 '19 at 18:34