qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Claudio Fontana <cfontana@suse.de>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	qemu-devel@nongnu.org, "Stefan Hajnoczi" <stefanha@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>
Subject: Re: [RFC] checkpatch: detect missing changes to trace-events
Date: Fri, 07 Aug 2020 08:21:27 +0200	[thread overview]
Message-ID: <87imdv0ye0.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20200806153331.23907-1-cfontana@suse.de> (Claudio Fontana's message of "Thu, 6 Aug 2020 17:33:31 +0200")

Claudio Fontana <cfontana@suse.de> writes:

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

I like the idea, but...

> 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?

... I'm also concerned about false positives.

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

The existing MAINTAINERS check warns even when an existing pattern
covers the new file, e.g. when I create or rename a file scripts/qapi/*
or qapi/*.json.  The former is definitely a false positive, and mildly
annoying.  The latter, however, could be a true positive: even though
the new file is covered by the "QAPI Schema" section, *additional*
coverage by some other section may be called for, just like
qapi/machine.json is additionally covered by "Machine core".  So, even
if checkpatch.pl looked at more than just the patch, suppressing false
positives would involve guesswork.

The new trace-events check is simpler: it's *always* a false positive
when the file doesn't include trace.h or trace-root.h.

Complication: it could include via some header.  I figure that's rare
enough to be ignored.

Howver, checkpatch.pl checks *patches* by design[*].  It doesn't read
the patched files to get more context, or additional files.

Perhaps it's simply the wrong place both for the MAINTAINERS check and
the trace-events check.  We put the MAINTAINERS check there, because it
exists and developers run it.  "make check-source" would be another
option, except it doesn't exist.  CI would be yet another option, but we
should be careful about what to check only in CI.


[*] There's -f to check a source file, which checks "diff -u /dev/null
$filename".



  reply	other threads:[~2020-08-07  6:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-06 15:33 [RFC] checkpatch: detect missing changes to trace-events Claudio Fontana
2020-08-07  6:21 ` Markus Armbruster [this message]
2020-08-07 11:07   ` Claudio Fontana

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87imdv0ye0.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=cfontana@suse.de \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).