public inbox for linux-doc@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Sasha Levin <sashal@kernel.org>,
	dwaipayanray1@gmail.com,  lukas.bulwahn@gmail.com
Cc: corbet@lwn.net, skhan@linuxfoundation.org, apw@canonical.com,
	 workflows@vger.kernel.org, linux-doc@vger.kernel.org,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH] checkpatch: add --json output mode
Date: Mon, 06 Apr 2026 13:41:52 -0700	[thread overview]
Message-ID: <646163fbd76af208762fce6953b03ec84ffdd19a.camel@perches.com> (raw)
In-Reply-To: <20260406170039.4034716-1-sashal@kernel.org>

On Mon, 2026-04-06 at 13:00 -0400, Sasha Levin wrote:
> Add a --json flag to checkpatch.pl that emits structured JSON output,
> making results machine-parseable for CI systems, IDE integrations, and
> AI-assisted code review tools.

Seems a reasonable idea but perhaps can be improved

> @@ -1372,7 +1376,7 @@ for my $filename (@ARGV) {
>  	$file = $oldfile if ($is_git_file);
>  }
>  
> -if (!$quiet) {
> +if (!$quiet && !$json) {
>  	hash_show_words(\%use_type, "Used");
>  	hash_show_words(\%ignore_type, "Ignored");

Maybe keep but update?

> @@ -7791,18 +7836,33 @@ sub process {
>  	# If we have no input at all, then there is nothing to report on
>  	# so just keep quiet.
>  	if ($#rawlines == -1) {
> +		if ($json) {
> +			print '{"filename":"' . json_escape($filename) .
> +			      '","total_errors":0,"total_warnings":0,' .

poor formatting for that trailing ".  please separate by content blocks.

> +			      '"total_checks":0,"total_lines":0,"issues":[]}' . "\n";
> +		}

I'd prefer to keep the print() style used elsewhere
and perhaps the JSON:PP module should be used here.

      parent reply	other threads:[~2026-04-06 20:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-06 17:00 [PATCH] checkpatch: add --json output mode Sasha Levin
2026-04-06 19:00 ` Konstantin Ryabitsev
2026-04-06 19:13   ` Sasha Levin
2026-04-06 19:22     ` Konstantin Ryabitsev
2026-04-06 20:34       ` Joe Perches
2026-04-06 20:41 ` Joe Perches [this message]

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=646163fbd76af208762fce6953b03ec84ffdd19a.camel@perches.com \
    --to=joe@perches.com \
    --cc=apw@canonical.com \
    --cc=corbet@lwn.net \
    --cc=dwaipayanray1@gmail.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    --cc=sashal@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=workflows@vger.kernel.org \
    /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