aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2017-11-17 18:28:52 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-17 19:10:02 -0500
commit5751a24edfd43a91e072d63cde2b99b5a421645f (patch)
tree50bd9ee4f7fb35bdebb54e917bef568cbbb2b7b1 /scripts/checkpatch.pl
parent87bd499af5cd663c150032cca4bac822a729263b (diff)
checkpatch: add --strict test for lines ending in [ or (
Lines that end in an open bracket or open parenthesis are generally hard to follow. Lines following those ending with open parenthesis are also rarely aligned to that open parenthesis. Suggest not ending lines with '[' or '(' Link: http://lkml.kernel.org/r/8fd0b2b4a7482064254e37931eb9302a81d5aa2f.1508340786.git.joe@perches.com Signed-off-by: Joe Perches <joe@perches.com> Suggested-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl6
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 6bdd43d5dec5..3453df9f90ab 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3184,6 +3184,12 @@ sub process {
3184# check we are in a valid C source file if not then ignore this hunk 3184# check we are in a valid C source file if not then ignore this hunk
3185 next if ($realfile !~ /\.(h|c)$/); 3185 next if ($realfile !~ /\.(h|c)$/);
3186 3186
3187# check for unusual line ending [ or (
3188 if ($line =~ /^\+.*([\[\(])\s*$/) {
3189 CHK("OPEN_ENDED_LINE",
3190 "Lines should not end with a '$1'\n" . $herecurr);
3191 }
3192
3187# check if this appears to be the start function declaration, save the name 3193# check if this appears to be the start function declaration, save the name
3188 if ($sline =~ /^\+\{\s*$/ && 3194 if ($sline =~ /^\+\{\s*$/ &&
3189 $prevline =~ /^\+(?:(?:(?:$Storage|$Inline)\s*)*\s*$Type\s*)?($Ident)\(/) { 3195 $prevline =~ /^\+(?:(?:(?:$Storage|$Inline)\s*)*\s*$Type\s*)?($Ident)\(/) {