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
31843184 # check we are in a valid C source file if not then ignore this hunk
31853185 next if ($realfile !~ /\.(h|c)$/);
31863186
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+
31873193 # check if this appears to be the start function declaration, save the name
31883194 if ($sline =~ /^\+\{\s*$/ &&
31893195 $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