Skip to content

Commit

Permalink
checkpatch: improve EMBEDDED_FILENAME test
Browse files Browse the repository at this point in the history
Privately, Heinz Mauelshagen showed that the embedded filename test is not
specific enough.

> WARNING: It's generally not useful to have the filename in the file
> #113: FILE: errors.c:113:
> +            block < registered_errors.blocks + registered_errors.count;

Extend the test to use the appropriate word boundary tests.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Joe Perches <[email protected]>
Reported-by: Heinz Mauelshagen <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
JoePerches authored and akpm00 committed Feb 3, 2023
1 parent 3ee2a3e commit 3621735
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -3751,7 +3751,7 @@ sub process {
}

# check for embedded filenames
if ($rawline =~ /^\+.*\Q$realfile\E/) {
if ($rawline =~ /^\+.*\b\Q$realfile\E\b/) {
WARN("EMBEDDED_FILENAME",
"It's generally not useful to have the filename in the file\n" . $herecurr);
}
Expand Down

0 comments on commit 3621735

Please sign in to comment.