lkml.org 
[lkml]   [2023]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] checkpatch: Improve EMBEDDED_FILENAME test
From
Date
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.

Reported-by: Heinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: Joe Perches <joe@perches.com>
---

Heinz, next time please make sure to CC linux-kernel@vger.kernel.org

scripts/checkpatch.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a6d6d7e1d0cf1..40102bc0ce535 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3727,7 +3727,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);
}
\
 
 \ /
  Last update: 2023-03-26 23:54    [W:0.039 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site