public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] checkpatch: Emit a warning on embedded filenames
@ 2020-10-01 18:28 Joe Perches
  2020-10-01 18:47 ` external tool to remove " Joe Perches
  2020-10-02 22:18 ` [PATCH] checkpatch: Emit a warning on " Andrew Morton
  0 siblings, 2 replies; 6+ messages in thread
From: Joe Perches @ 2020-10-01 18:28 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Andy Whitcroft, LKML

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@perches.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)$/);
 



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-10-02 23:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-01 18:28 [PATCH] checkpatch: Emit a warning on embedded filenames Joe Perches
2020-10-01 18:47 ` external tool to remove " Joe Perches
2020-10-02 14:49   ` Bhaskar Chowdhury
2020-10-02 15:13     ` Joe Perches
2020-10-02 22:18 ` [PATCH] checkpatch: Emit a warning on " Andrew Morton
2020-10-02 23:35   ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox