Re: [PATCH] checkpatch: add --json output mode

From: Konstantin Ryabitsev

Date: Mon Apr 06 2026 - 15:22:40 EST


On Mon, Apr 06, 2026 at 03:13:52PM -0400, Sasha Levin wrote:
> > I see that it's writing json out manually, implementing its own escaping.
> > While there are upsides to not requiring a perl json library, I think it's
> > fair to expect that people who would want to get json output can probably make
> > sure that JSON::XS is installed.
> >
> > Not a strong object, but seems cleaner that way.
>
> No objection here, but from what I saw the checkpatch code only uses core perl
> packages so I wanted to keep it that way.

I saw that, too, but I think that stems from the expectation that we need to
make it easy to run checkpatch by any random person submitting patches, which
is why, by default, we'll output human-readable results.

JSON output, on the other hand, is mostly useful for specific setups that have
a lot more control over their environment and we don't have to stick to the
"pure perl only" guideline here.

Generating correct json is an exercise in corner cases, which is why I'd
rather this is done with a library that has addressed most of them already.

Regards,
--
KR