History

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 '('

Joe Perches committed 8 years ago

Commit 5751a241 parent 87bd4991 file · +6 −0Browse files

Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all

Unified · Split

scripts/checkpatch.pl+6−0
@@ -3184,6 +3184,12 @@ sub process { · 3183 unmodified lines
3184# check we are in a valid C source file if not then ignore this hunk3184# 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 name3193# 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)\(/) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t