checkpatch: allow build files to reference other build files
Subsystems (2)
PATCH v2 1/1 checkpatch: allow build files to reference other build files
Add an exception to the EMBEDDED_FILENAME warning for build files. This fixes the below warnings where the Kconfig and Makefile files reference other similarly named build files.
WARNING:EMBEDDED_FILENAME: It's generally not useful to have the filename in the file #24: FILE: Kconfig:34:
+source "drivers/willmcvicker/Kconfig"
WARNING:EMBEDDED_FILENAME: It's generally not useful to have the filename in the file #36: FILE: Makefile:667:
+ } > Makefile
--- scripts/checkpatch.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
v2:
- Unwrap commit message lines
- Align and update regex
scripts/checkpatch.pl +2 -1
@@ -3785,7 +3785,8 @@ sub process { } # check for embedded filenames - if ($rawline =~ /^\+.*\b\Q$realfile\E\b/) { + if ($rawline =~ /^\+.*\b\Q$realfile\E\b/ && + $realfile !~ /(?:Kconfig|Makefile)/) { WARN("EMBEDDED_FILENAME", "It's generally not useful to have the filename in the file\n" . $herecurr); }
base-commit: 70d201a40823acba23899342d62bc2644051ad2e
Signature · 1 line
2.43.0.275.g3460e3d667-goog
Quoted 1 line · Will McVicker
Add an exception to the
EMBEDDED_FILENAMEwarning for build files. This
As far as I can see, your patch fixes only the checkpatch warnings for top-level Makefile and Kconfig (and leaving out top-level Kbuild). Other build files are not affected, right?
Kind regards,
Nicolas
Quoted 40 lines
fixes the below warnings where the
KconfigandMakefilefiles reference other similarly named build files.WARNING:EMBEDDED_FILENAME: It's generally not useful to have the filename in the file #24: FILE: Kconfig:34:
+source "drivers/willmcvicker/Kconfig"WARNING:EMBEDDED_FILENAME: It's generally not useful to have the filename in the file #36: FILE: Makefile:667:
+ } >MakefileSigned-off-by Will McVicker <[email protected]>--- scripts/checkpatch.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)v2:
- Unwrap commit message lines
- Align and update regexscripts/checkpatch.pl +2
-1@@ -3785,7 +3785,8 @@ sub process { } # check for embedded filenames - if ($rawline =~ /^\+.*\b\Q$realfile\E\b/) { + if ($rawline =~ /^\+.*\b\Q$realfile\E\b/ && + $realfile !~ /(?:Kconfig|Makefile)/) { WARN("EMBEDDED_FILENAME", "It's generally not useful to have the filename in the file\n" . $herecurr); }base-commit:
70d201a40823acba23899342d62bc2644051ad2eSignature · 1 line
2.43.0.275.g3460e3d667-goog
Quoted 6 lines · Nicolas Schier
Quoted 1 line · Will McVicker
Add an exception to the
EMBEDDED_FILENAMEwarning for build files. ThisAs far as I can see, your patch fixes only the checkpatch warnings for top-level
MakefileandKconfig(and leaving out top-levelKbuild). Other build files are not affected, right?
Since $realfile includes the full path, I wasn't able to find a case where this issue happens outside of the top-level build files. The same goes for Kbuild files -- the top-level Kbuild file doesn't include other Kbuild files and the other Kbuild files don't include other Kbuild files within the same directory. If you prefer to protect against this warning in the future, I can include Kbuild as well if you want.
Thanks,
Will
Quoted 45 lines
Kind regards,
NicolasQuoted 40 lines
fixes the below warnings where the
KconfigandMakefilefiles reference other similarly named build files.WARNING:EMBEDDED_FILENAME: It's generally not useful to have the filename in the file #24: FILE: Kconfig:34:
+source "drivers/willmcvicker/Kconfig"WARNING:EMBEDDED_FILENAME: It's generally not useful to have the filename in the file #36: FILE: Makefile:667:
+ } >MakefileSigned-off-by Will McVicker <[email protected]>--- scripts/checkpatch.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)v2:
- Unwrap commit message lines
- Align and update regexscripts/checkpatch.pl +2
-1@@ -3785,7 +3785,8 @@ sub process { } # check for embedded filenames - if ($rawline =~ /^\+.*\b\Q$realfile\E\b/) { + if ($rawline =~ /^\+.*\b\Q$realfile\E\b/ && + $realfile !~ /(?:Kconfig|Makefile)/) { WARN("EMBEDDED_FILENAME", "It's generally not useful to have the filename in the file\n" . $herecurr); }base-commit:
70d201a40823acba23899342d62bc2644051ad2eSignature · 1 line
2.43.0.275.g3460e3d667-goog
Quoted 8 lines · William McVicker
Quoted 6 lines · Nicolas Schier
Quoted 1 line · Will McVicker
Add an exception to the
EMBEDDED_FILENAMEwarning for build files. ThisAs far as I can see, your patch fixes only the checkpatch warnings for top-level
MakefileandKconfig(and leaving out top-levelKbuild). Other build files are not affected, right?
Quoted 6 lines
Since $realfile includes the full path, I wasn't able to find a case where this issue happens outside of the top-level build files. The same goes for
Kbuildfiles -- the top-levelKbuildfile doesn't include otherKbuildfiles and the otherKbuildfiles don't include otherKbuildfiles within the same directory. If you prefer to protect against this warning in the future, I can includeKbuildas well if you want.
yes, I think it would be more complete if top-level Kbuild is also included. Could you also mention 'top-level' somewhere in the commit message?
Thanks and kind regards,
Nicolas