mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 05:31:08 -04:00
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. [[email protected]: remove stray " di"] Signed-off-by: Joe Perches <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
1 parent
e7f929f3ca
commit
a0154cdbd3
1 file changed
+6
@@ -3271,6 +3271,12 @@ sub process {
|
||||
}
|
||||
}
|
||||
|
||||
# check for embedded filenames
|
||||
if ($rawline =~ /^\+.*\Q$realfile\E/) {
|
||||
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)$/);
|
||||
|
||||
|
||||
Reference in new issue
Block a user