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

Sasha Levin
2026-04-26T00:07:46Z

On Sat, Apr 25, 2026 at 02:52:35PM -0700, Joe Perches wrote:
>On 2026-04-25 13:04, 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.
>[]
>>A separate --json-pretty flag emits the same JSON in a pretty-printed
>>(indented, multi-line) form for human reading
>
>Why not just always use pretty?
>Would a script care?

Who's the intended consumer for the --json-pretty?

I my mind, --json is there to make it easier for tooling to process the output.

A user can already achieve the same result by piping the json output through jq
or other similar tools:

$ ./scripts/checkpatch.pl --json 0001-checkpatch-add-json-output-mode.patch
{"filename":"0001-checkpatch-add-json-output-mode.patch","ignored_types":[],"issues":[],"total_checks":0,"total_errors":0,"total_lines":189,"total_warnings":0,"used_types":[]}
$ ./scripts/checkpatch.pl --json 0001-checkpatch-add-json-output-mode.patch | jq
{
"filename": "0001-checkpatch-add-json-output-mode.patch",
"ignored_types": [],
"issues": [],
"total_checks": 0,
"total_errors": 0,
"total_lines": 189,
"total_warnings": 0,
"used_types": []
}

--
Thanks,
Sasha