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 '('
Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all
Unified · Split
| @@ -3184,6 +3184,12 @@ sub process { · 3183 unmodified lines | |||
| 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)\(/) { |