Skip to contentSkip to conversation

checkpatch: improve MAINTAINERS file update test

PATCH Joe Perches 2 participants 2 messages Jul 27, 2020 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 4 lines · Daniel Dadap

Add an additional regular expression to detect updates to the MAINTAINERS file as reported in the unified diffs generated by git format-patch. This suppresses the "does MAINTAINERS need updating" message when MAINTAINERS is updated with this format.

Please cc at least LKML.

scripts/checkpatch.pl

Quoted 1 line
scripts/checkpatch.pl +0 -0

[]

scripts/checkpatch.pl sub process { · line 2625

Quoted 7 lines
scripts/checkpatch.pl +2 -1
@@ -2621,7 +2621,8 @@ sub process {
 
 # Check if MAINTAINERS is being updated.  If so, there's probably no need to
 # emit the "does MAINTAINERS need updating?" message on file add/move/delete
-		if ($line =~ /^\s*MAINTAINERS\s*\|/) {
+		if ($line =~ /^\s*MAINTAINERS\s*\|/ ||
+		    $line =~ /^[-+]{3} [ab]\/MAINTAINERS$/) {

I don't believe this works well as any test for a file modification to MAINTAINERS occurs after the block that would show a diffstat where the warning is emitted.

#2 lore raw
Quoted 9 lines · Joe Perches

External email: Use caution opening links or attachments

Quoted 4 lines · Daniel Dadap

Add an additional regular expression to detect updates to the MAINTAINERS file as reported in the unified diffs generated by git format-patch. This suppresses the "does MAINTAINERS need updating" message when MAINTAINERS is updated with this format.

Please cc at least LKML.

Oops; thanks for adding the list. I'll be sure to include it for any revised patches.

Quoted 4 lines

scripts/checkpatch.pl

Quoted 1 line
scripts/checkpatch.pl +0 -0

[]

Quoted 2 lines
scripts/checkpatch.pl +0 -0
@@ -2621,7 +2621,8 @@ sub process {
 
Quoted 9 lines

scripts/checkpatch.pl sub process { · line 2625

Quoted 5 lines
scripts/checkpatch.pl +2 -1
  # Check if MAINTAINERS is being updated.  If so, there's probably no need to
  # emit the "does MAINTAINERS need updating?" message on file add/move/delete
-             if ($line =~ /^\s*MAINTAINERS\s*\|/) {
+             if ($line =~ /^\s*MAINTAINERS\s*\|/ ||
+                 $line =~ /^[-+]{3} [ab]\/MAINTAINERS$/) {

I don't believe this works well as any test for a file modification to MAINTAINERS occurs after the block that would show a diffstat where the warning is emitted.

Hmm. It must have worked for me because the MAINTAINERS file appeared earlier in the patch than a newly added file in a patch I was checking that triggers this warning before this change, but doesn't after this change. This needn't be the case, though. Would it make sense to move the check for a diffstat-style /^\sMAINTAINERS\s*\|/ as well as a unidiff-style /^[-+]{3} [ab]\/MAINTAINERS$/ to the pre-scan sanitize phase?