History

checkpatch/coding-style: deprecate 80-column warning

Yes, staying withing 80 columns is certainly still _preferred_. But it's not the hard limit that the checkpatch warnings imply, and other concerns can most certainly dominate. Increase the default limit to 100 characters. Not because 100 characters is some hard limit either, but that's certainly a "what are you doing" kind of value and less likely to be about the occasional slightly longer lines. Miscellanea: - to avoid unnecessary whitespace changes in files, checkpatch will no longer emit a warning about line length when scanning files unless --strict is also used - Add a bit to coding-style about alignment to open parenthesis

Joe Perches committed 6 years ago

Commit bdc48fa1 parent 8fc984a2 files · +23 −14Browse files

Unified · Split

2 files
  1. Documentation/process/coding-style.rst +14 −9
  2. scripts/checkpatch.pl +9 −5
Documentation/process/coding-style.rst+14−9
@@ -84,15 +84,20 @@ Get a decent editor and don't leave whitespace at the end of lines. · 83 unmodified lines
8484 Coding style is all about readability and maintainability using commonly
8585 available tools.
8686
87−The limit on the length of lines is 80 columns and this is a strongly
88−preferred limit.
89−
90−Statements longer than 80 columns will be broken into sensible chunks, unless
91−exceeding 80 columns significantly increases readability and does not hide
92−information. Descendants are always substantially shorter than the parent and
93−are placed substantially to the right. The same applies to function headers
94−with a long argument list. However, never break user-visible strings such as
95−printk messages, because that breaks the ability to grep for them.
87+The preferred limit on the length of a single line is 80 columns.
88+
89+Statements longer than 80 columns should be broken into sensible chunks,
90+unless exceeding 80 columns significantly increases readability and does
91+not hide information.
92+
93+Descendants are always substantially shorter than the parent and are
94+are placed substantially to the right. A very commonly used style
95+is to align descendants to a function open parenthesis.
96+
97+These same rules are applied to function headers with a long argument list.
98+
99+However, never break user-visible strings such as printk messages because
100+that breaks the ability to grep for them.
96101
97102
98103 3) Placing Braces and Spaces
scripts/checkpatch.pl+9−5
@@ -51,7 +51,7 @@ my %ignore_type = (); · 50 unmodified lines
5151 my @ignore = ();
5252 my $help = 0;
5353 my $configuration_file = ".checkpatch.conf";
54−my $max_line_length = 80;
54+my $max_line_length = 100;
5555 my $ignore_perl_version = 0;
5656 my $minimum_perl_version = 5.10.0;
5757 my $min_conf_desc_length = 4;
@@ -97,9 +97,11 @@ Options: · 39 unmodified lines
9797 --types TYPE(,TYPE2...) show only these comma separated message types
9898 --ignore TYPE(,TYPE2...) ignore various comma separated message types
9999 --show-types show the specific message type in the output
100− --max-line-length=n set the maximum line length, if exceeded, warn
100+ --max-line-length=n set the maximum line length, (default $max_line_length)
101+ if exceeded, warn on patches
102+ requires --strict for use with --file
101103 --min-conf-desc-length=n set the min description length, if shorter, warn
102− --tab-size=n set the number of spaces for tab (default 8)
104+ --tab-size=n set the number of spaces for tab (default $tabsize)
103105 --root=PATH PATH to the kernel tree root
104106 --no-summary suppress the per-file summary
105107 --mailback only produce a report in case of warnings/errors
@@ -3240,8 +3242,10 @@ sub process { · 3134 unmodified lines
32403242
32413243 if ($msg_type ne "" &&
32423244 (show_type("LONG_LINE") || show_type($msg_type))) {
3243− WARN($msg_type,
3244− "line over $max_line_length characters\n" . $herecurr);
3245+ my $msg_level = \&WARN;
3246+ $msg_level = \&CHK if ($file);
3247+ &{$msg_level}($msg_type,
3248+ "line length of $length exceeds $max_line_length columns\n" . $herecurr);
32453249 }
32463250 }
32473251