From: Joe Perches <joe@perches.com>
To: Aditya Srivastava <yashsri421@gmail.com>
Cc: linux-kernel-mentees@lists.linuxfoundation.org,
linux-kernel@vger.kernel.org, lukas.bulwahn@gmail.com
Subject: Re: [PATCH v2] checkpatch: add fix option for MAINTAINERS_STYLE
Date: Mon, 16 Nov 2020 13:55:44 -0800 [thread overview]
Message-ID: <d675ffc7c85c68117c3e2d78d2e35679f778a9c2.camel@perches.com> (raw)
In-Reply-To: <20201116071930.7733-1-yashsri421@gmail.com>
On Mon, 2020-11-16 at 12:49 +0530, Aditya Srivastava wrote:
> Checkpatch expects entries in MAINTAINERS file in a specific order and
> warns if the changes made do not follow the specified order.
>
> E.g., running checkpatch on commit 6f736909f0a4 ("MAINTAINERS: Add
> patchwork link for PWM entry") reports this warning:
>
> WARNING: Misordered MAINTAINERS entry - list 'Q:' before 'T:'
> T: git git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm.git
> +Q: https://patchwork.ozlabs.org/project/linux-pwm/list/
>
> Provide a simple fix by swapping the unordered lines
NAK.
This --fix option can't work if a patch merely adds a single line.
The patch context lines would be wrong.
This has to make sure the both lines are additions (start with +)
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -3299,13 +3299,22 @@ sub process {
> "Unknown MAINTAINERS entry type: '$cur'\n" . $herecurr);
> } else {
> if ($previndex >= 0 && $curindex < $previndex) {
> - WARN("MAINTAINERS_STYLE",
> - "Misordered MAINTAINERS entry - list '$cur:' before '$prev:'\n" . $hereprev);
> + if (WARN("MAINTAINERS_STYLE",
> + "Misordered MAINTAINERS entry - list '$cur:' before '$prev:'\n" . $hereprev) &&
> + $fix) {
> + # swap these lines
> + $fixed[$fixlinenr - 1] = $rawline;
> + $fixed[$fixlinenr] = $prevrawline;
> + }
> } elsif ((($prev eq 'F' && $cur eq 'F') ||
> ($prev eq 'X' && $cur eq 'X')) &&
> ($prevval cmp $curval) > 0) {
> - WARN("MAINTAINERS_STYLE",
> - "Misordered MAINTAINERS entry - list file patterns in alphabetic order\n" . $hereprev);
> + if (WARN("MAINTAINERS_STYLE",
> + "Misordered MAINTAINERS entry - list file patterns in alphabetic order\n" . $hereprev) &&
> + $fix) {
> + $fixed[$fixlinenr - 1] = $rawline;
> + $fixed[$fixlinenr] = $prevrawline;
> + }
> }
> }
> }
prev parent reply other threads:[~2020-11-16 21:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-16 7:19 Aditya Srivastava
2020-11-16 21:55 ` 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=d675ffc7c85c68117c3e2d78d2e35679f778a9c2.camel@perches.com \
--to=joe@perches.com \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas.bulwahn@gmail.com \
--cc=yashsri421@gmail.com \
/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®