[PATCH v2] checkpatch: allow build files to reference other build files
From: Will McVicker
Date: Fri Jan 12 2024 - 17:20:08 EST
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
Signed-off-by: Will McVicker <willmcvicker@xxxxxxxxxx>
---
scripts/checkpatch.pl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
v2:
- Unwrap commit message lines
- Align and update regex
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index f8343b34a28b..c2869803e545 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -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
--
2.43.0.275.g3460e3d667-goog