diff options
author | Joe Perches <joe@perches.com> | 2020-10-16 06:12:19 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-10-16 21:11:21 +0300 |
commit | a0154cdbd3dcf2b1b92f42cb1351a63f3f947e80 (patch) | |
tree | 6757efb8dacb5b1b36bfe77ae0b84fb8da785b08 /scripts | |
parent | e7f929f3ca9ecadb7d38340345920af49e09eb6a (diff) | |
download | linux-a0154cdbd3dcf2b1b92f42cb1351a63f3f947e80.tar.xz |
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.
[akpm@linux-foundation.org: remove stray " di"]
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Link: https://lkml.kernel.org/r/1fd5f9188a14acdca703ca00301ee323de672a8d.camel@perches.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/checkpatch.pl | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index f40a81f24d43..5424134e201d 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -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)$/); |