[cfe-dev] [clang-tidy] RFC: "Experimental" checkers
Whisperity via cfe-dev
cfe-dev at lists.llvm.org
Wed Mar 25 05:31:50 PDT 2020
Dear List,
This is a generic interest pitch mail about adding the notion of
"experimental" checks to Clang-Tidy.
(A *very* rudimentary patch about the experimental group is here:
http://reviews.llvm.org/D76545.)
The reason behind this idea is from the discussion with Aaron on a check
that I developed and proposing for the suite. Review *of the check* here:
http://reviews.llvm.org/D69560.
Summary (of the experimental idea):
- Certain rules (such as the one mentioned above) cannot (yet?) be
implemented properly, due to various constraints
- However, parts of the rule that *could* be implemented might turn out to
be useful for the community
- It's not nice to "sell" a checker named "foo-bar" if it only does "bar"
partially — but coming up with a different name is superfluous as we wish
to convey the intent that we support "bar" fully later on.
The Clang Static Analyser people have a similar notion of "alpha.",
however, several concerns about modelling that approach for Tidy has been
expressed, namely:
- the lifespan of checkers in the alpha. group is too long for Tidy's(?)
taste
- alpha checkers are allowed to have crashes, lots of false positives,
senseless output, etc.
- it's generally a "you're on your own" situation if you decide to run
alpha checkers
It's understandable that we wish to be something more stable, but this
needs more input from a broader set of people.
I believe that requiring stability (i.e. no crashes in general, or
performance issues) from upstramed experimental checkers is a good idea.
The core idea of an experimental checker could be:
"Here's a rule, it's a nice rule, here's an automated tool for that, let's
see what it does on live projects. This can help us develop further, or
maybe even do rounds of revising/extending the rule/best practice itself!"
----
First things first: main group, or subgroup?
We could organise the situation in two ways:
- Having a top level group "experimental-<originally targeted
group>-checker-name"
- Or having a "subgroup" under each main group: "<originally targeted
group>-experimental-checker-name"
In the latter case, I believe *not* turning on experimental checks unless
the user explicitly requests (in some fashion) is necessary.
There're a few key bureaucracy points that need to be discussed before
moving forward:
1. What's the accepted quality level for a patch to be merged as an
experimental check? Where is the line between full-size checker, vs. an
experimental?
2. What's the life cycle concerns involved by experimental checkers?
Remember, that checkers merged into upstream will be "sold" as an LLVM
feature.
For 1., I think (and hopefully this is a somewhat neutral point of view
argument, even though it's my patch) that the checker I'm proposing (
http://reviews.llvm.org/D69560) is a good example. There's a well-defined
idea, and a large part of the implementation *works* in practice. (And -
hopefully - there's a small amount of weird crashes here and there, I've
did my best to eliminate what I could.)
For 2., I'm with more lack of words. To reiterate a claim from the review
of the "new group idea": In ClangSA, there are alpha checkers that had been
there for years, but so far never made out of alpha, whereas requiring
constant maintenance (at least to the point of making sure an internal API
break is patched into them...)
"We don't want 'experimental-' to become a dumping ground for bad quality
checks."
There should be at least the general idea that we can, in the future,
declare the experiment to have failed (for whatever reason, be it lack of
interest, change of winds, or technical issues), and eventually deprecate
and remove the related check.
The other path, where the experiment is a success is easier, hopefully a
simple rename (and some aliasing) can solve it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200325/af90ffad/attachment.html>
More information about the cfe-dev
mailing list