From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25237C63798 for ; Tue, 17 Nov 2020 04:20:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D62832463D for ; Tue, 17 Nov 2020 04:20:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727023AbgKQEUp (ORCPT ); Mon, 16 Nov 2020 23:20:45 -0500 Received: from smtprelay0039.hostedemail.com ([216.40.44.39]:33848 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726826AbgKQEUp (ORCPT ); Mon, 16 Nov 2020 23:20:45 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay03.hostedemail.com (Postfix) with ESMTP id 83C7A837F24A; Tue, 17 Nov 2020 04:20:44 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: birth03_35059fb2732e X-Filterd-Recvd-Size: 3269 Received: from XPS-9350.home (unknown [47.151.133.149]) (Authenticated sender: joe@perches.com) by omf19.hostedemail.com (Postfix) with ESMTPA; Tue, 17 Nov 2020 04:20:43 +0000 (UTC) Message-ID: <477496bed101ed007e7e8db6d511ece2fa2d119c.camel@perches.com> Subject: Re: [PATCH v3] checkpatch: add fix option for MAINTAINERS_STYLE From: Joe Perches To: Aditya Srivastava , Andrew Morton Cc: linux-kernel-mentees@lists.linuxfoundation.org, linux-kernel@vger.kernel.org, lukas.bulwahn@gmail.com Date: Mon, 16 Nov 2020 20:20:42 -0800 In-Reply-To: <20201117040501.21914-1-yashsri421@gmail.com> References: <20201117040501.21914-1-yashsri421@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.38.1-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2020-11-17 at 09:35 +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 b33bc2b878e0 ("nexthop: Add entry to > MAINTAINERS") reports this warning: > > WARNING: Misordered MAINTAINERS entry - list file patterns in > alphabetic order > +F: include/uapi/linux/nexthop.h > +F: include/net/netns/nexthop.h OK, this should work. Thanks Aditya. Acked-by: Joe Perches > > Provide a simple fix by swapping the unordered lines, if both the lines > are additions (start with '+') > > Signed-off-by: Aditya Srivastava > --- > Changes in v2: > modified commit message > > Changes in v3: > add check if both the lines are additions(ie start with '+') > >  scripts/checkpatch.pl | 17 +++++++++++++---- >  1 file changed, 13 insertions(+), 4 deletions(-) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index 2749f32dffe9..7ee3f05c354d 100755 > --- 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 && $prevrawline =~ /^\+[A-Z]:/) { > + # 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 && $prevrawline =~ /^\+[A-Z]:/) { > + $fixed[$fixlinenr - 1] = $rawline; > + $fixed[$fixlinenr] = $prevrawline; > + } >   } >   } >   }