checkpatch: warn about missing MAINTAINERS file changes
PATCH 1/1 checkpatch: warn about missing MAINTAINERS file changes
Warn if files are added/renamed/deleted without MAINTAINERS file changes. This has helped me in Linux and we could benefit from this check in QEMU.
This patch is a manual cherry-pick of Linux commit 13f1937ef33950b1112049972249e6191b82e6c9 ("checkpatch: emit a warning on file add/move/delete") by Joe Perches <[email protected]>.
---
Note the 80-char lines are from upstream code. Keep them as-is.
scripts/checkpatch.pl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
scripts/checkpatch.pl +19 -0
@@ -1177,6 +1177,7 @@ sub process { our $clean = 1; my $signoff = 0; my $is_patch = 0; + my $reported_maintainer_file = 0; our @report = (); our $cnt_lines = 0;
@@ -1379,6 +1380,24 @@ 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*\|/) { + $reported_maintainer_file = 1; + } + +# Check for added, moved or deleted files + if (!$reported_maintainer_file && + ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ || + $line =~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ || + ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ && + (defined($1) || defined($2))))) { + $is_patch = 1; + $reported_maintainer_file = 1; + WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\n" . + $herecurr); + } + # Check for wrappage within a valid hunk of the file if ($realcnt != 0 && $line !~ m{^(?:\+|-| |\\ No newline|$)}) { ERROR("patch seems to be corrupt (line wrapped?)\n" .
Signature · 1 line
2.14.3
Quoted 9 lines · Stefan Hajnoczi
Warn if files are added/renamed/deleted without
MAINTAINERSfile changes. This has helped me in Linux and we could benefit from this check in QEMU.This patch is a manual cherry-pick of Linux commit
13f1937ef33950b1112049972249e6191b82e6c9("checkpatch: emit a warning on file add/move/delete") by Joe Perches <[email protected]>.Signed-off-by Stefan Hajnoczi <[email protected]>
nice,
Quoted 47 lines
---
Note the 80-char lines are from upstream code. Keep them as-is.scripts/checkpatch.pl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)scripts/checkpatch.pl +19
-1@@ -1177,6 +1177,7 @@ sub process { our $clean = 1; my $signoff = 0; my $is_patch = 0; + my $reported_maintainer_file = 0; our @report = (); our $cnt_lines = 0;@@ -1379,6 +1380,24 @@ 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*\|/) { + $reported_maintainer_file = 1; + } + +# Check for added, moved or deleted files + if (!$reported_maintainer_file && + ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ || + $line =~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ || + ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ && + (defined($1) || defined($2))))) { + $is_patch = 1; + $reported_maintainer_file = 1; + WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\n" . + $herecurr); + } + # Check for wrappage within a valid hunk of the file if ($realcnt != 0 && $line !~ m{^(?:\+|-| |\\ No newline|$)}) { ERROR("patch seems to be corrupt (line wrapped?)\n" . --2.14.3
Signature · 1 line
Marc-André Lureau
Quoted 10 lines · Stefan Hajnoczi
Warn if files are added/renamed/deleted without
MAINTAINERSfile changes. This has helped me in Linux and we could benefit from this check in QEMU.This patch is a manual cherry-pick of Linux commit
13f1937ef33950b1112049972249e6191b82e6c9("checkpatch: emit a warning on file add/move/delete") by Joe Perches <[email protected]>.Signed-off-by Stefan Hajnoczi <[email protected]>---
Unfortunately the patch doesn't magically cause maintainers to appear for the new files :-)
thanks
-- PMM
Quoted 37 lines · Stefan Hajnoczi
Warn if files are added/renamed/deleted without
MAINTAINERSfile changes. This has helped me in Linux and we could benefit from this check in QEMU.This patch is a manual cherry-pick of Linux commit
13f1937ef33950b1112049972249e6191b82e6c9("checkpatch: emit a warning on file add/move/delete") by Joe Perches <[email protected]>.Signed-off-by Stefan Hajnoczi <[email protected]>---
Note the 80-char lines are from upstream code. Keep them as-is.scripts/checkpatch.pl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)scripts/checkpatch.pl +7
-0@@ -1177,6 +1177,7 @@ sub process { our $clean = 1; my $signoff = 0; my $is_patch = 0; + my $reported_maintainer_file = 0; our @report = (); our $cnt_lines = 0;@@ -1379,6 +1380,24 @@ 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*\|/) { + $reported_maintainer_file = 1; + } +
scripts/checkpatch.pl sub process { · line 1398
Quoted 10 lines
scripts/checkpatch.pl +10
-0+# Check for added, moved or deleted files + if (!$reported_maintainer_file && + ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ || + $line =~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ || + ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ && + (defined($1) || defined($2))))) { + $is_patch = 1; + $reported_maintainer_file = 1; + WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\n" . + $herecurr);
Could you please turn this into a notification instead of a warning? For rationale, please see the discussion of this patch last year:
http://lists.gnu.org/archive/html/qemu-devel/2017-01/msg05753.html
Thanks,
Thomas
Quoted 52 lines · Thomas Huth
Quoted 37 lines · Stefan Hajnoczi
Warn if files are added/renamed/deleted without
MAINTAINERSfile changes. This has helped me in Linux and we could benefit from this check in QEMU.This patch is a manual cherry-pick of Linux commit
13f1937ef33950b1112049972249e6191b82e6c9("checkpatch: emit a warning on file add/move/delete") by Joe Perches <[email protected]>.Signed-off-by Stefan Hajnoczi <[email protected]>---
Note the 80-char lines are from upstream code. Keep them as-is.scripts/checkpatch.pl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)scripts/checkpatch.pl +7
-0@@ -1177,6 +1177,7 @@ sub process { our $clean = 1; my $signoff = 0; my $is_patch = 0; + my $reported_maintainer_file = 0; our @report = (); our $cnt_lines = 0;@@ -1379,6 +1380,24 @@ 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*\|/) { + $reported_maintainer_file = 1; + } +scripts/checkpatch.pl sub process { · line 1398
Quoted 10 lines
scripts/checkpatch.pl +10
-0+# Check for added, moved or deleted files + if (!$reported_maintainer_file && + ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ || + $line =~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ || + ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ && + (defined($1) || defined($2))))) { + $is_patch = 1; + $reported_maintainer_file = 1; + WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\n" . + $herecurr);Could you please turn this into a notification instead of a warning? For rationale, please see the discussion of this patch last year:
It's a warning, not an error, so this already means "don't treat it as fatal".
Why is a warning a bad user experience but a notification would be fine?
Stefan
Quoted 53 lines · Stefan Hajnoczi
Quoted 52 lines · Thomas Huth
Quoted 37 lines · Stefan Hajnoczi
Warn if files are added/renamed/deleted without
MAINTAINERSfile changes. This has helped me in Linux and we could benefit from this check in QEMU.This patch is a manual cherry-pick of Linux commit
13f1937ef33950b1112049972249e6191b82e6c9("checkpatch: emit a warning on file add/move/delete") by Joe Perches <[email protected]>.Signed-off-by Stefan Hajnoczi <[email protected]>---
Note the 80-char lines are from upstream code. Keep them as-is.scripts/checkpatch.pl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)scripts/checkpatch.pl +7
-0@@ -1177,6 +1177,7 @@ sub process { our $clean = 1; my $signoff = 0; my $is_patch = 0; + my $reported_maintainer_file = 0; our @report = (); our $cnt_lines = 0;@@ -1379,6 +1380,24 @@ 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*\|/) { + $reported_maintainer_file = 1; + } +scripts/checkpatch.pl sub process { · line 1398
Quoted 10 lines
scripts/checkpatch.pl +10
-0+# Check for added, moved or deleted files + if (!$reported_maintainer_file && + ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ || + $line =~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ || + ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ && + (defined($1) || defined($2))))) { + $is_patch = 1; + $reported_maintainer_file = 1; + WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\n" . + $herecurr);Could you please turn this into a notification instead of a warning? For rationale, please see the discussion of this patch last year:
Quoted 6 lines
It's a warning, not an error, so this already means "don't treat it as fatal".
Why is a warning a bad user experience but a notification would be fine?
Since this will likely cause a lot of false positives. I think people will then rather be annoyed if checkpatch.pl nags them with a warning in these cases.
Thomas
This series seems to have some coding style problems. See output below for more information:
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PATCH] checkpatch: warn about missing MAINTAINERS file changes
=== TEST SCRIPT BEGIN ===
#!/bin/bash
BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))done
exit $failed
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 Switched to a new branch 'test'89d665069d checkpatch: warn about missing MAINTAINERS file changes
=== OUTPUT BEGIN ===
Checking PATCH 1/1: checkpatch: warn about missing MAINTAINERS file changes...
WARNING: line over 80 characters
#47: FILE: scripts/checkpatch.pl:1393:
+ ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ &&
ERROR: line over 90 characters
#51: FILE: scripts/checkpatch.pl:1397:
+ WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\n" .
total: 1 errors, 1 warnings, 31 lines checked
Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===
Test command exited with code: 1
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]
Quoted 56 lines · Thomas Huth
Quoted 55 lines · Stefan Hajnoczi
Quoted 53 lines · Thomas Huth
Quoted 37 lines · Stefan Hajnoczi
Warn if files are added/renamed/deleted without
MAINTAINERSfile changes. This has helped me in Linux and we could benefit from this check in QEMU.This patch is a manual cherry-pick of Linux commit
13f1937ef33950b1112049972249e6191b82e6c9("checkpatch: emit a warning on file add/move/delete") by Joe Perches <[email protected]>.Signed-off-by Stefan Hajnoczi <[email protected]>---
Note the 80-char lines are from upstream code. Keep them as-is.scripts/checkpatch.pl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)scripts/checkpatch.pl +7
-0@@ -1177,6 +1177,7 @@ sub process { our $clean = 1; my $signoff = 0; my $is_patch = 0; + my $reported_maintainer_file = 0; our @report = (); our $cnt_lines = 0;@@ -1379,6 +1380,24 @@ 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*\|/) { + $reported_maintainer_file = 1; + } +scripts/checkpatch.pl sub process { · line 1398
Quoted 10 lines
scripts/checkpatch.pl +10
-0+# Check for added, moved or deleted files + if (!$reported_maintainer_file && + ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ || + $line =~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ || + ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ && + (defined($1) || defined($2))))) { + $is_patch = 1; + $reported_maintainer_file = 1; + WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\n" . + $herecurr);Could you please turn this into a notification instead of a warning? For rationale, please see the discussion of this patch last year:
http://lists.gnu.org/archive/html/qemu-devel/2017-01/msg05753.html
Quoted 8 lines
Quoted 4 lines
It's a warning, not an error, so this already means "don't treat it as fatal".
Why is a warning a bad user experience but a notification would be fine?
Since this will likely cause a lot of false positives. I think people will then rather be annoyed if checkpatch.pl nags them with a warning in these cases.
This approach works fine for Linux, I don't think it will be a problem for QEMU.
The idea of zero false positives is nice though. Do you have time to implement a real MAINTAINERS checker that avoids false positives (i.e. it applies the MAINTAINERS hunk in the patch, if present, onto the current MAINTAINERS file and then looks up every new file or rename)?
Stefan
Quoted 10 lines · Thomas Huth
Quoted 9 lines · Stefan Hajnoczi
Warn if files are added/renamed/deleted without
MAINTAINERSfile changes. This has helped me in Linux and we could benefit from this check in QEMU.This patch is a manual cherry-pick of Linux commit
13f1937ef33950b1112049972249e6191b82e6c9("checkpatch: emit a warning on file add/move/delete") by Joe Perches <[email protected]>.Signed-off-by Stefan Hajnoczi <[email protected]>
We should really keep upstream's S-o-b intact. I'd keep the whole commit message intact:
From 7fb819c27bf47041a13feed93f86a15bdb2c681f Mon Sep 17 00:00:00 2001
From: Joe Perches <[email protected]>
Date: Wed, 6 Aug 2014 16:10:59 -0700
Subject: [PATCH] checkpatch: emit a warning on file add/move/delete
Whenever files are added, moved, or deleted, the MAINTAINERS file patterns can be out of sync or outdated.
To try to keep MAINTAINERS more up-to-date, add a one-time warning whenever a patch does any of those.
Created by running "git-format-patch -1 13f1937ef33" in the kernel, feeding that to git-am (patch doesn't apply), patch -p1 your patch, git-am --continue, git-commit --amend to add a backporting note and your S-o-b.
Quoted 42 lines
Quoted 28 lines
---
Note the 80-char lines are from upstream code. Keep them as-is.scripts/checkpatch.pl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)scripts/checkpatch.pl +7
-0@@ -1177,6 +1177,7 @@ sub process { our $clean = 1; my $signoff = 0; my $is_patch = 0; + my $reported_maintainer_file = 0; our @report = (); our $cnt_lines = 0;@@ -1379,6 +1380,24 @@ 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*\|/) { + $reported_maintainer_file = 1; + } +scripts/checkpatch.pl sub process { · line 1398
Quoted 10 lines
scripts/checkpatch.pl +10
-0+# Check for added, moved or deleted files + if (!$reported_maintainer_file && + ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ || + $line =~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ || + ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ && + (defined($1) || defined($2))))) { + $is_patch = 1; + $reported_maintainer_file = 1; + WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\n" . + $herecurr);Could you please turn this into a notification instead of a warning? For rationale, please see the discussion of this patch last year:
Quoting that one:
I think chances are high that it still pops up quite frequently with false positives:
1) The above regex only triggers for patches that contain a diffstat. If you run the script on patches without diffstat, you always get the warning as soon as you add, delete or move a file, even if you update the MAINTAINERS file in the same patch.
"Doctor, it hurts when I create patches without a diffstat."
2) I think it is quite common in patch series to first introduce new files in the first patches, and then update MAINTAINERS only once at the end.
That's an okay thing to do now. But is it a valid reason to block tooling improvements that will help us stop the constant trickle of new files without a maintainer? Having to update MAINTAINERS along the way isn't *that* much of a burden; we'll get used to it.
3) The MAINTAINERS file often covers whole folders with wildcard expressions. So if you add/delete/rename a file within such a folder, you don't need to update MAINTAINERS thanks to the wildcard.
True. Perhaps the kernel would appreciate a suitable checkpatch.pl improvement.
I guess people might be annoyed if checkpatch.pl throws a warning in these cases. So a "NOTE: ..." sounds more sane to me. But if you like, we can also start with a WARNING first and only ease it if people start to complain?
I'd stick to the upstream version. But if it takes deviations to get this improvement accepted, I can live with them, as long as patchew still flags offenders.
Quoted 9 lines · Peter Maydell
Quoted 8 lines · Stefan Hajnoczi
Warn if files are added/renamed/deleted without
MAINTAINERSfile changes. This has helped me in Linux and we could benefit from this check in QEMU.This patch is a manual cherry-pick of Linux commit
13f1937ef33950b1112049972249e6191b82e6c9("checkpatch: emit a warning on file add/move/delete") by Joe Perches <[email protected]>.
Quoted 5 lines
Quoted 2 lines
Signed-off-by Stefan Hajnoczi <[email protected]>---
Unfortunately the patch doesn't magically cause maintainers to appear for the new files :-)
Fortunately, the patch can get new files non-magically rejected unless a maintainers appears :)
Quoted 11 lines · Markus Armbruster
Quoted 9 lines · Peter Maydell
Quoted 8 lines · Stefan Hajnoczi
Warn if files are added/renamed/deleted without
MAINTAINERSfile changes. This has helped me in Linux and we could benefit from this check in QEMU.This patch is a manual cherry-pick of Linux commit
13f1937ef33950b1112049972249e6191b82e6c9("checkpatch: emit a warning on file add/move/delete") by Joe Perches <[email protected]>.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Signed-off-by Stefan Hajnoczi <[email protected]>---
Unfortunately the patch doesn't magically cause maintainers to appear for the new files :-)
Fortunately, the patch can get new files non-magically rejected unless a maintainers appears :)
I think that "author of code lists themselves in MAINTAINERS but then doesn't in practice do anything" is not really much better (and arguably worse) than "code has no listed maintainer".
thanks
-- PMM
Quoted 18 lines · Peter Maydell
Quoted 17 lines · Markus Armbruster
Quoted 14 lines · Peter Maydell
Quoted 10 lines · Stefan Hajnoczi
Warn if files are added/renamed/deleted without
MAINTAINERSfile changes. This has helped me in Linux and we could benefit from this check in QEMU.This patch is a manual cherry-pick of Linux commit
13f1937ef33950b1112049972249e6191b82e6c9("checkpatch: emit a warning on file add/move/delete") by Joe Perches <[email protected]>.Signed-off-by Stefan Hajnoczi <[email protected]>---
Unfortunately the patch doesn't magically cause maintainers to appear for the new files :-)
Quoted 6 lines
Quoted 2 lines
Fortunately, the patch can get new files non-magically rejected unless a maintainers appears :)
I think that "author of code lists themselves in
MAINTAINERSbut then doesn't in practice do anything" is not really much better (and arguably worse) than "code has no listed maintainer".
Having our tooling flag new and moved files for a possible MAINTAINERS update need not mean adding J. Random Codeslinger to MAINTAINERS. It should make us stop and think.
If the kernel guys can do that, why can't we?
Quoted 111 lines · Markus Armbruster
Quoted 10 lines · Thomas Huth
Quoted 9 lines · Stefan Hajnoczi
Warn if files are added/renamed/deleted without
MAINTAINERSfile changes. This has helped me in Linux and we could benefit from this check in QEMU.This patch is a manual cherry-pick of Linux commit
13f1937ef33950b1112049972249e6191b82e6c9("checkpatch: emit a warning on file add/move/delete") by Joe Perches <[email protected]>.Signed-off-by Stefan Hajnoczi <[email protected]>We should really keep upstream's S-o-b intact. I'd keep the whole commit message intact:
From
7fb819c27bf47041a13feed93f86a15bdb2c681fMon Sep 17 00:00:00 2001
From: Joe Perches <[email protected]>
Date: Wed, 6 Aug 2014 16:10:59 -0700
Subject: [PATCH] checkpatch: emit a warning on file add/move/deleteWhenever files are added, moved, or deleted, the
MAINTAINERSfile patterns can be out of sync or outdated.To try to keep
MAINTAINERSmore up-to-date, add a one-time warning whenever a patch does any of those.Signed-off-by Joe Perches <[email protected]>Acked-by Andy Whitcroft <[email protected]>Signed-off-by Andrew Morton <[email protected]>Signed-off-by Linus Torvalds <[email protected]>[Cherry picked from Linux commit 13f1937ef33950b1112049972249e6191b82e6c9]Signed-off-by Stefan Hajnoczi <[email protected]>Created by running "git-format-patch -1
13f1937ef33" in the kernel, feeding that to git-am (patch doesn't apply), patch -p1 your patch, git-am --continue, git-commit --amend to add a backporting note and your S-o-b.Quoted 42 lines
Quoted 28 lines
---
Note the 80-char lines are from upstream code. Keep them as-is.scripts/checkpatch.pl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)scripts/checkpatch.pl +7
-0@@ -1177,6 +1177,7 @@ sub process { our $clean = 1; my $signoff = 0; my $is_patch = 0; + my $reported_maintainer_file = 0; our @report = (); our $cnt_lines = 0;@@ -1379,6 +1380,24 @@ 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*\|/) { + $reported_maintainer_file = 1; + } +scripts/checkpatch.pl sub process { · line 1398
Quoted 10 lines
scripts/checkpatch.pl +10
-0+# Check for added, moved or deleted files + if (!$reported_maintainer_file && + ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ || + $line =~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ || + ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ && + (defined($1) || defined($2))))) { + $is_patch = 1; + $reported_maintainer_file = 1; + WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\n" . + $herecurr);Could you please turn this into a notification instead of a warning? For rationale, please see the discussion of this patch last year:
Quoting that one:
I think chances are high that it still pops up quite frequently with false positives:
1) The above regex only triggers for patches that contain a diffstat. If you run the script on patches without diffstat, you always get the warning as soon as you add, delete or move a file, even if you update the
MAINTAINERSfile in the same patch."Doctor, it hurts when I create patches without a diffstat."
2) I think it is quite common in patch series to first introduce new files in the first patches, and then update
MAINTAINERSonly once at the end.That's an okay thing to do now. But is it a valid reason to block tooling improvements that will help us stop the constant trickle of new files without a maintainer? Having to update
MAINTAINERSalong the way isn't *that* much of a burden; we'll get used to it.3) The
MAINTAINERSfile often covers whole folders with wildcard expressions. So if you add/delete/rename a file within such a folder, you don't need to updateMAINTAINERSthanks to the wildcard.True. Perhaps the kernel would appreciate a suitable checkpatch.pl improvement.
Quoted 9 lines
I guess people might be annoyed if checkpatch.pl throws a warning in these cases. So a "NOTE: ..." sounds more sane to me. But if you like, we can also start with a WARNING first and only ease it if people start to complain?
I'd stick to the upstream version. But if it takes deviations to get this improvement accepted, I can live with them, as long as patchew still flags offenders.
Patchew doesn't speak up unless there is an "error". Warnings and notes are not complained about to keep good signal-to-noise ratio.
Fam
Quoted 83 lines · Fam Zheng
Quoted 82 lines · Markus Armbruster
Quoted 10 lines · Thomas Huth
Quoted 9 lines · Stefan Hajnoczi
Warn if files are added/renamed/deleted without
MAINTAINERSfile changes. This has helped me in Linux and we could benefit from this check in QEMU.This patch is a manual cherry-pick of Linux commit
13f1937ef33950b1112049972249e6191b82e6c9("checkpatch: emit a warning on file add/move/delete") by Joe Perches <[email protected]>.Signed-off-by Stefan Hajnoczi <[email protected]>We should really keep upstream's S-o-b intact. I'd keep the whole commit message intact:
From
7fb819c27bf47041a13feed93f86a15bdb2c681fMon Sep 17 00:00:00 2001
From: Joe Perches <[email protected]>
Date: Wed, 6 Aug 2014 16:10:59 -0700
Subject: [PATCH] checkpatch: emit a warning on file add/move/deleteWhenever files are added, moved, or deleted, the
MAINTAINERSfile patterns can be out of sync or outdated.To try to keep
MAINTAINERSmore up-to-date, add a one-time warning whenever a patch does any of those.Signed-off-by Joe Perches <[email protected]>Acked-by Andy Whitcroft <[email protected]>Signed-off-by Andrew Morton <[email protected]>Signed-off-by Linus Torvalds <[email protected]>[Cherry picked from Linux commit 13f1937ef33950b1112049972249e6191b82e6c9]Signed-off-by Stefan Hajnoczi <[email protected]>Created by running "git-format-patch -1
13f1937ef33" in the kernel, feeding that to git-am (patch doesn't apply), patch -p1 your patch, git-am --continue, git-commit --amend to add a backporting note and your S-o-b.Quoted 43 lines
Quoted 28 lines
---
Note the 80-char lines are from upstream code. Keep them as-is.scripts/checkpatch.pl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)scripts/checkpatch.pl +7
-0@@ -1177,6 +1177,7 @@ sub process { our $clean = 1; my $signoff = 0; my $is_patch = 0; + my $reported_maintainer_file = 0; our @report = (); our $cnt_lines = 0;@@ -1379,6 +1380,24 @@ 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*\|/) { + $reported_maintainer_file = 1; + } +scripts/checkpatch.pl sub process { · line 1398
Quoted 10 lines
scripts/checkpatch.pl +10
-0+# Check for added, moved or deleted files + if (!$reported_maintainer_file && + ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ || + $line =~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ || + ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ && + (defined($1) || defined($2))))) { + $is_patch = 1; + $reported_maintainer_file = 1; + WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\n" . + $herecurr);Could you please turn this into a notification instead of a warning? For rationale, please see the discussion of this patch last year:
http://lists.gnu.org/archive/html/qemu-devel/2017-01/msg05753.html
[...]
Quoted 2 lines
Patchew doesn't speak up unless there is an "error". Warnings and notes are not complained about to keep good signal-to-noise ratio.
Ah, ok, didn't know that, that makes sense. Then I'm fine with the code above. But while you're at it, could you please also include the other patches that I posted last year, e.g. to warn on wrong utf-8 in the message? We've had mojibaked commit messages a couple of times already, and I hope that patch will help to reduce this a little bit...
Thomas