From: Joe Perches <joe@perches.com>
To: Sasha Levin <sashal@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] get_maintainer: add --json output mode
Date: Mon, 06 Apr 2026 19:38:47 -0700 [thread overview]
Message-ID: <001ffb26478da41247e2500e1102b4e34f9808fc.camel@perches.com> (raw)
In-Reply-To: <20260406170138.4034983-1-sashal@kernel.org>
On Mon, 2026-04-06 at 13:01 -0400, Sasha Levin wrote:
> Add a --json flag to get_maintainer.pl that emits structured JSON
> output, making results machine-parseable for CI systems, IDE
> integrations, and AI-assisted development tools.
OK here too but perhaps the code can be consolidated a bit more.
> diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
> index 4414194bedcfd..37817ca701bd6 100755
> --- a/scripts/get_maintainer.pl
> +++ b/scripts/get_maintainer.pl
> @@ -68,6 +68,7 @@ my $pattern_depth = 0;
> my $self_test = undef;
> my $version = 0;
> my $help = 0;
> +my $json = 0;
> my $find_maintainer_files = 0;
> my $maintainer_path;
> my $vcs_used = 0;
> @@ -285,6 +286,7 @@ if (!GetOptions(
> 'find-maintainer-files' => \$find_maintainer_files,
> 'mpath|maintainer-path=s' => \$maintainer_path,
> 'self-test:s' => \$self_test,
> + 'json!' => \$json,
> 'v|version' => \$version,
> 'h|help|usage' => \$help,
> )) {
> @@ -648,39 +650,74 @@ my %deduplicate_name_hash = ();
> my %deduplicate_address_hash = ();
>
> my @maintainers = get_maintainers();
> -if (@maintainers) {
> - @maintainers = merge_email(@maintainers);
> - output(@maintainers);
> -}
>
> -if ($scm) {
> - @scm = uniq(@scm);
> - output(@scm);
> -}
> +if ($json) {
> + my @json_maintainers;
> + if (@maintainers) {
> + my %saw;
> + for (@maintainers) {
> + my ($address, $role) = @$_;
> + if (!$saw{$address}) {
> + my ($name, $email_addr) = parse_email($address);
> + my $entry = '{"name":"' . json_escape_str($name) .
> + '","email":"' . json_escape_str($email_addr) . '"';
> + $entry .= ',"role":"' . json_escape_str($role) . '"' if ($output_roles && $role ne '');
> + $entry .= '}';
> + push(@json_maintainers, $entry);
> + $saw{$address} = 1;
Isn't this effectively the merge_email(@maintainers) above?
Why not use it?
next prev parent reply other threads:[~2026-04-07 2:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-06 17:01 Sasha Levin
2026-04-07 2:38 ` Joe Perches [this message]
2026-04-08 19:45 ` [PATCH v2] " Sasha Levin
2026-04-08 20:06 ` Joe Perches
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=001ffb26478da41247e2500e1102b4e34f9808fc.camel@perches.com \
--to=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sashal@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
all inboxes | Powered by JetHome®