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
84Coding style is all about readability and maintainability using commonly84Coding style is all about readability and maintainability using commonly
85available tools.85available tools.
86 86
87The limit on the length of lines is 80 columns and this is a strongly87The preferred limit on the length of a single line is 80 columns.
88preferred limit.88
89 89Statements longer than 80 columns should be broken into sensible chunks,
90Statements longer than 80 columns will be broken into sensible chunks, unless90unless exceeding 80 columns significantly increases readability and does
91exceeding 80 columns significantly increases readability and does not hide91not hide information.
92information. Descendants are always substantially shorter than the parent and92
93are placed substantially to the right. The same applies to function headers93Descendants are always substantially shorter than the parent and are
94with a long argument list. However, never break user-visible strings such as94are placed substantially to the right. A very commonly used style
95printk messages, because that breaks the ability to grep for them.95is to align descendants to a function open parenthesis.
96
97These same rules are applied to function headers with a long argument list.
98
99However, never break user-visible strings such as printk messages because
100that breaks the ability to grep for them.
96 101
97 102
983) Placing Braces and Spaces1033) Placing Braces and Spaces
scripts/checkpatch.pl+9−5
@@ -51,7 +51,7 @@ my %ignore_type = (); · 50 unmodified lines
51my @ignore = ();51my @ignore = ();
52my $help = 0;52my $help = 0;
53my $configuration_file = ".checkpatch.conf";53my $configuration_file = ".checkpatch.conf";
54my $max_line_length = 80;54my $max_line_length = 100;
55my $ignore_perl_version = 0;55my $ignore_perl_version = 0;
56my $minimum_perl_version = 5.10.0;56my $minimum_perl_version = 5.10.0;
57my $min_conf_desc_length = 4;57my $min_conf_desc_length = 4;
@@ -97,9 +97,11 @@ Options: · 39 unmodified lines
97 --types TYPE(,TYPE2...) show only these comma separated message types97 --types TYPE(,TYPE2...) show only these comma separated message types
98 --ignore TYPE(,TYPE2...) ignore various comma separated message types98 --ignore TYPE(,TYPE2...) ignore various comma separated message types
99 --show-types show the specific message type in the output99 --show-types show the specific message type in the output
100 --max-line-length=n set the maximum line length, if exceeded, warn100 --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
101 --min-conf-desc-length=n set the min description length, if shorter, warn103 --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)
103 --root=PATH PATH to the kernel tree root105 --root=PATH PATH to the kernel tree root
104 --no-summary suppress the per-file summary106 --no-summary suppress the per-file summary
105 --mailback only produce a report in case of warnings/errors107 --mailback only produce a report in case of warnings/errors
@@ -3240,8 +3242,10 @@ sub process { · 3134 unmodified lines
3240 3242
3241 if ($msg_type ne "" &&3243 if ($msg_type ne "" &&
3242 (show_type("LONG_LINE") || show_type($msg_type))) {3244 (show_type("LONG_LINE") || show_type($msg_type))) {
3243 WARN($msg_type,3245 my $msg_level = \&WARN;
3244 "line over $max_line_length characters\n" . $herecurr);3246 $msg_level = \&CHK if ($file);
3247 &{$msg_level}($msg_type,
3248 "line length of $length exceeds $max_line_length columns\n" . $herecurr);
3245 }3249 }
3246 }3250 }
3247 3251