checkpatch: Fix bad FILE_PATH_CHANGES on headers
PATCH 1/1 checkpatch: Fix bad FILE_PATH_CHANGES on headers
The FILE_PATH_CHANGES warning ("added, moved or deleted file(s), does MAINTAINERS need updating?") added by commit 13f1937ef339 ("checkpatch:
emit a warning on file add/move/delete") was guarded by !$in_commit_log so that commit message lines would not be mistaken for diffstat or diff header lines.
However, it was still evaluated on the initial email header lines ($in_header_lines == 1) such that a title using the rename notation e.g.
Subject: [PATCH] foo: rework bar_{get=>set}_baz()
triggers a false-positive warning. Furthermore, that same (wrong) code path sets $is_patch prematurely.
Instead, only test for FILE_PATH_CHANGES when !$in_header_lines.
--- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +1 -1
@@ -3481,7 +3481,7 @@ sub process { } # Check for added, moved or deleted files - if (!$reported_maintainer_file && !$in_commit_log && + if (!$reported_maintainer_file && !$in_commit_log && !$in_header_lines && ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ || $line =~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ || ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ &&
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261107-checkpatch-file_path_changes-ac920c85bc7e
Best regards,
Signature · 1 line
Pierre-Clément Tosi <[email protected]>
Quoted 6 lines · Pierre-Clément Tosi
The
FILE_PATH_CHANGESwarning ("added, moved or deleted file(s), doesMAINTAINERSneed updating?") added by commit13f1937ef339("checkpatch:
emit a warning on file add/move/delete") was guarded by !$in_commit_log so that commit message lines would not be mistaken for diffstat or diff header lines.
Quoted 7 lines
However, it was still evaluated on the initial email header lines ($in_header_lines == 1) such that a title using the rename notation e.g.
Subject: [PATCH] foo: rework bar_{get=>set}_baz()
triggers a false-positive warning. Furthermore, that same (wrong) code path sets $is_patch prematurely.
cute. Thanks again.
Quoted 28 lines
Instead, only test for
FILE_PATH_CHANGESwhen !$in_header_lines.Fixes 13f1937ef339 ("checkpatch: emit a warning on file add/move/delete")Signed-off-by Pierre-Clément Tosi <[email protected]>--- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/checkpatch.pl +1
-2@@ -3481,7 +3481,7 @@ sub process { } # Check for added, moved or deleted files - if (!$reported_maintainer_file && !$in_commit_log && + if (!$reported_maintainer_file && !$in_commit_log && !$in_header_lines && ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ || $line =~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ || ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ && ---base-commit:
6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261107-checkpatch-file_path_changes-ac920c85bc7eBest regards,