qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [RFC] checkpatch: detect missing changes to trace-events
@ 2020-08-06 15:33 Claudio Fontana
  2020-08-07  6:21 ` Markus Armbruster
  0 siblings, 1 reply; 3+ messages in thread
From: Claudio Fontana @ 2020-08-06 15:33 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin, Philippe Mathieu-Daudé,
	Stefan Hajnoczi, Alex Bennée
  Cc: Claudio Fontana, qemu-devel

Signed-off-by: Claudio Fontana <cfontana@suse.de>
---
 scripts/checkpatch.pl | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

We could do something similar to MAINTAINERS for trace-events,
ie warning about files added, moved, deleted if we don't see
an update to a trace-events file.

To make it more solid it would be better to check the
actual file contents for #include "trace.h" or "trace-root.h",
but I guess this is not possible/practice from checkpatch?

If we could only warn for files moved that actually include
trace.h or trace-root.h, we could avoid a lot of false positives.

Thanks,

Claudio

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index bd3faa154c..1c8afebed5 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1300,6 +1300,7 @@ sub process {
 	my $in_header_lines = $file ? 0 : 1;
 	my $in_commit_log = 0;		#Scanning lines before patch
 	my $reported_maintainer_file = 0;
+	my $reported_trace_events_file = 0;
 	my $non_utf8_charset = 0;
 
 	our @report = ();
@@ -1524,15 +1525,24 @@ sub process {
 		if ($line =~ /^\s*MAINTAINERS\s*\|/) {
 			$reported_maintainer_file = 1;
 		}
-
+# similar check for trace-events
+		if ($line =~ /^\s*trace-events\s*\|/) {
+			$reported_trace_events_file = 1;
+		}
 # Check for added, moved or deleted files
-		if (!$reported_maintainer_file && !$in_commit_log &&
+		if (!$in_commit_log &&
 		    ($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))))) {
-			$reported_maintainer_file = 1;
-			WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\n" . $herecurr);
+			if (!$reported_maintainer_file) {
+				$reported_maintainer_file = 1;
+				WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\n" . $herecurr);
+			}
+			if (!$reported_trace_events_file) {
+				$reported_trace_events_file = 1;
+				WARN("added, moved or deleted file(s), does trace-events need updating?\n" . $herecurr);
+			}
 		}
 
 # Check for wrappage within a valid hunk of the file
-- 
2.16.4



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

end of thread, other threads:[~2020-08-07 11:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-06 15:33 [RFC] checkpatch: detect missing changes to trace-events Claudio Fontana
2020-08-07  6:21 ` Markus Armbruster
2020-08-07 11:07   ` Claudio Fontana

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).