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
> torvalds#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/36069dac5d07509dab1c7f1238f8cbb08db80ac6.camel@perches.com
Signed-off-by: Joe Perches <joe@perches.com>
Reported-by: Heinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
  • Loading branch information
JoePerches authored and akpm00 committed Jan 27, 2023
1 parent 67556c1 commit 2a5b55a
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 2a5b55a

Please sign in to comment.