[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1fd5f9188a14acdca703ca00301ee323de672a8d.camel@perches.com>
Date: Thu, 01 Oct 2020 11:28:10 -0700
From: Joe Perches <joe@...ches.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Andy Whitcroft <apw@...onical.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] checkpatch: Emit a warning on embedded filenames
Embedding the complete filename path inside the file
isn't particularly useful as often the path is moved
around and becomes incorrect.
Emit a warning when the source contains the filename.
Signed-off-by: Joe Perches <joe@...ches.com>
---
scripts/checkpatch.pl | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a213cdb82ab0..84d2ee118c55 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3273,6 +3273,12 @@ sub process {
}
}
+# check for embedded filenames
+ if ($rawline =~ /^\+.*\Q$realfile\E/) { di
+ WARN("EMBEDDED_FILENAME",
+ "It's generally not useful to have the filename in the file\n" . $herecurr);
+ }
+
# check we are in a valid source file if not then ignore this hunk
next if ($realfile !~ /\.(h|c|s|S|sh|dtsi|dts)$/);
Powered by blists - more mailing lists