[Linux-kernel-mentees] Addition of verbose mode to checkpatch

Lukas Bulwahn lukas.bulwahn at gmail.com
Sat Jan 23 03:14:23 UTC 2021


On Fri, Jan 22, 2021 at 10:27 PM Dwaipayan Ray <dwaipayanray1 at gmail.com> wrote:
>
> Hi Lukas and all,
> Recently while going through the warnings emitted by checkpatch,
> the necessity of a verbose mode came up once again. Joe had
> already suggested that a verbose mode would probably be worked
> on.
>
> As for how that could be done, that leaves us at a couple of options.
> Since writing verbose messages for all warnings aren't possible at once,
> there can be an optional extension when emitting messages:
>
> Currently, a warning can be emitted by
> WARN("TYPE", "Message")
> which could be converted to say:
> WARN('TYPE", "Message", "Verbose")
>
> Another way is to leave the original warning emitting syntax intact
> and instead go for a dictionary for verbose messages:
> our %dict = (
> "TYPE1" => "Verbose",
> "TYPE2" => "Verbose"
> ...);
>
> Although this leaves us the ability to customize the verbose output
> for each warning of a particular type.
>
> Which do you think would be best? Certainly more options might be
> possible, so any new inputs will be nice as well!
>

I think any of the two approaches would work.

But how about a completely different approach?

The verbose message is really an explanation of why kernel developers
think this rule should be followed (what is the history, what does it
try to warn about, what are possible fixes, what are accepted
deviations, ...).

So, this should not be placed into the checkpatch.pl script itself,
but into Documentation.

checkpatch.pl would simply quickly parse the Documentation and present
the content for the specific rules that were violated.

Let's say this Documentation is in
./Documentation/tools/checkpatch.rst, and they contain subsections
with labels/name with the TYPE identifier. Then when a warning of TYPE
is relevant for a specific patch, you print the description from that
one subsection.

In checkpatch itself, you would only need a very generic mechanism then.

Lukas


More information about the Linux-kernel-mentees mailing list