Clang Format Update
David Edmundson
david at davidedmundson.co.uk
Sat Jan 2 01:06:37 GMT 2021
It does. I've tried to collect some stats and provide some context on
the change.
Taking just plasma-workspace, we have a lot of lines over 100
characters at the moment.
3817 lines to be exact. ~3.3% [1]
We also have 146 lines over 160 chars. One is 383 chars long!
When the limit was 100 we had some feedback that we "break" those
lines, so the clang-format change was made explicitly to address that.
Especially as the existing framework policy is a "try to" not "you
must", so there is an argument that an explicit limit has to be
higher.
We can't fulfill the conflicting goals of both not affecting existing
code too much and simultaneously force the frameworks guideline as a
strict rule.
After running clang-format we get 4.0% of lines over 100 chars long,
and none over 160 chars.
So it does mean some lines get longer, but overall we're not talking
about a huge amount of code.
There is a MR on ECM for setting PenaltyBreakBeforeFirstCallParameter
which tries to push more to the 100 chars, if that's preferred.
We can also explore updating the frameworks policy given how we've
drifted apart from using it in our actual codebases.
David
[1] find -name '*\.cpp' | xargs cat | awk '{print length}' | sort |
uniq -c | awk '{print $2,$1}' | sort -n > line_length.csv
More information about the Plasma-devel
mailing list