From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Glen Choo via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Taylor Blau <me@ttaylorr.com>,
Elijah Newren <newren@gmail.com>, Glen Choo <chooglen@google.com>
Subject: Re: [PATCH 2/2] cocci: codify authoring and reviewing practices
Date: Sun, 16 Apr 2023 15:37:22 +0200 [thread overview]
Message-ID: <230416.86mt38rl2l.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <75feb18dfd8af03f5e7ba02403a16a0ed4c2edaa.1681329955.git.gitgitgadget@gmail.com>
On Wed, Apr 12 2023, Glen Choo via GitGitGadget wrote:
> From: Glen Choo <chooglen@google.com>
>
> This isn't set in stone; we expect this to be updated as the project
> evolves.
>
> Signed-off-by: Glen Choo <chooglen@google.com>
> ---
> contrib/coccinelle/README | 23 +++++++++++++++++++++++
> 1 file changed, 23 insertions(+)
>
> diff --git a/contrib/coccinelle/README b/contrib/coccinelle/README
> index 9b28ba1c57a..055e3622e5c 100644
> --- a/contrib/coccinelle/README
> +++ b/contrib/coccinelle/README
> @@ -92,3 +92,26 @@ that might be useful to developers.
>
> The absolute times will differ for you, but the relative speedup
> from caching should be on that order.
> +
> +== Authoring and reviewing coccinelle changes
> +
> +* When introducing and applying a new .cocci file, both the Git changes and
> + .cocci file should be reviewed.
> +
> +* Reviewers do not need to be coccinelle experts. To give a Reviewed-By, it is
> + enough for the reviewer to get a rough understanding of the proposed rules by
> + comparing the .cocci and Git changes, then checking that understanding
> + with the author.
Maybe it would be useful here to add something about how you can
reproduce the application of the coccinelle rule(s).
I sometimes do this on an ad-hoc basis, something like (untested):
git checkout HEAD^ -- ':!contrib/coccinelle' '*.[ch]'
make coccicheck
<apply any suggested patches>
git add -A
Then see if I ended up with a no-op, or if there's suggested changes.
With changes that modify both the header & source files this can be
tricky with the default of SPATCH_USE_O_DEPENDENCIES=Y, but disabling it
will take care of any potential circular dependency issues. I.e. when
the header doesn't contain a required construct that we're replacing.
> +* Conversely, authors should consider that reviewers may not be coccinelle
> + experts. The primary aim should be to make .cocci files easy to understand,
> + e.g. by adding comments or by using rules that are easier to understand even
> + if they are less elegant.
I agree that simple things should be kept simple, but this seems to come
quite close (or perhaps past the line of) suggesting that we use only
the simpler features of the language when a more elegant solution would
be available with something less well-known.
I think we should clarify that that's not the intent. Just as with C,
shellscript, Perl etc. we should aim for simplicity, but ultimately we
should expect that we can target the full available language available
to us.
> +* .cocci rules should target only the problem it is trying to solve; "collateral
> + damage" is not allowed.
I think what you mean here is that you should be able to apply the rule
and still build the project.
I think that's correct, but I also think that rather than define this in
prose, how about we just modify the current CI job to apply the result
of non-pending rules, and do a build at the end? Wouldn't that assert
this going forward.
> +* .cocci files used for refactoring should be temporarily kept in-tree to aid
> + the refactoring of out-of-tree code (e.g. in-flight topics). They should be
> + removed when enough time has been given for others to refactor their code,
> + i.e. ~1 release cycle.
Maybe s/should/can/? E.g. for my recent "index" and "the_repository"
patches I think they can, but we often keep unused code in-repo for
longer than that. If e.g. that code stayed in for more than one release
until someone cared to remove it we'd also be fine.
I also don't know if some long-running forks (e.g. GfW?) would benefit
from the rules for longer than that...
next prev parent reply other threads:[~2023-04-16 13:52 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-12 20:05 [PATCH 0/2] cocci: codify authoring and reviewing practices Glen Choo via GitGitGadget
2023-04-12 20:05 ` [PATCH 1/2] cocci: add headings to and reword README Glen Choo via GitGitGadget
2023-04-12 21:18 ` Junio C Hamano
2023-04-13 18:37 ` Glen Choo
2023-04-13 18:51 ` Junio C Hamano
2023-04-12 20:05 ` [PATCH 2/2] cocci: codify authoring and reviewing practices Glen Choo via GitGitGadget
2023-04-16 7:42 ` SZEDER Gábor
2023-04-19 19:29 ` Glen Choo
2023-04-20 20:53 ` [PATCH] cocci: remove 'unused.cocci' SZEDER Gábor
2023-04-21 2:43 ` Junio C Hamano
2023-05-01 13:27 ` Ævar Arnfjörð Bjarmason
2023-05-01 15:55 ` Junio C Hamano
2023-05-01 17:28 ` Ævar Arnfjörð Bjarmason
2023-05-10 22:45 ` Junio C Hamano
2023-04-16 13:37 ` Ævar Arnfjörð Bjarmason [this message]
2023-04-19 22:30 ` [PATCH 2/2] cocci: codify authoring and reviewing practices Glen Choo
2023-04-15 1:27 ` [PATCH 0/2] " Elijah Newren
2023-04-17 16:21 ` Junio C Hamano
2023-04-27 22:22 ` [PATCH v2 " Glen Choo via GitGitGadget
2023-04-27 22:22 ` [PATCH v2 1/2] cocci: add headings to and reword README Glen Choo via GitGitGadget
2023-05-01 10:53 ` Ævar Arnfjörð Bjarmason
2023-05-01 15:06 ` Junio C Hamano
2023-05-02 19:29 ` Felipe Contreras
2023-05-02 19:30 ` Felipe Contreras
2023-05-09 17:54 ` Glen Choo
2023-04-27 22:22 ` [PATCH v2 2/2] cocci: codify authoring and reviewing practices Glen Choo via GitGitGadget
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=230416.86mt38rl2l.gmgdl@evledraar.gmail.com \
--to=avarab@gmail.com \
--cc=chooglen@google.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=me@ttaylorr.com \
--cc=newren@gmail.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).