The patch titled Subject: checkpatch: emit a warning on embedded filenames has been added to the -mm tree. Its filename is checkpatch-emit-a-warning-on-embedded-filenames.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/checkpatch-emit-a-warning-on-embedded-filenames.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/checkpatch-emit-a-warning-on-embedded-filenames.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Joe Perches <joe@xxxxxxxxxxx> Subject: 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. Link: https://lkml.kernel.org/r/1fd5f9188a14acdca703ca00301ee323de672a8d.camel@xxxxxxxxxxx Signed-off-by: Joe Perches <joe@xxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- scripts/checkpatch.pl | 6 ++++++ 1 file changed, 6 insertions(+) --- a/scripts/checkpatch.pl~checkpatch-emit-a-warning-on-embedded-filenames +++ a/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)$/); _ Patches currently in -mm which might be from joe@xxxxxxxxxxx are get_maintainer-add-test-for-file-in-vcs.patch get_maintainer-exclude-maintainers-files-from-git-fallback.patch checkpatch-move-repeated-word-test.patch checkpatch-add-test-for-comma-use-that-should-be-semicolon.patch checkpatch-warn-on-self-assignments.patch checkpatch-allow-not-using-f-with-files-that-are-in-git.patch checkpatch-allow-not-using-f-with-files-that-are-in-git-fix.patch checkpatch-test-git_dir-changes.patch checkpatch-emit-a-warning-on-embedded-filenames.patch