qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] checkpatch: warn about missing MAINTAINERS file changes
@ 2018-03-12 13:18 Stefan Hajnoczi
  2018-03-12 13:33 ` Marc-André Lureau
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Stefan Hajnoczi @ 2018-03-12 13:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Stefan Hajnoczi

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 <joe@perches.com>.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
Note the 80-char lines are from upstream code.  Keep them as-is.

 scripts/checkpatch.pl | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d1fe79bcc4..d0d8f63d48 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -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

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-04-19  5:09 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-12 13:18 [Qemu-devel] [PATCH] checkpatch: warn about missing MAINTAINERS file changes Stefan Hajnoczi
2018-03-12 13:33 ` Marc-André Lureau
2018-03-12 13:34 ` Peter Maydell
2018-04-16 14:11   ` Markus Armbruster
2018-04-16 14:28     ` Peter Maydell
2018-04-16 16:11       ` Markus Armbruster
2018-03-12 13:46 ` Thomas Huth
2018-03-13 10:37   ` Stefan Hajnoczi
2018-03-13 10:49     ` Thomas Huth
2018-03-15 11:50       ` Stefan Hajnoczi
2018-04-16 14:09   ` Markus Armbruster
2018-04-19  2:06     ` Fam Zheng
2018-04-19  5:08       ` Thomas Huth
2018-03-12 17:58 ` no-reply

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).