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=-11.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,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 81268C388F9 for ; Mon, 16 Nov 2020 21:56:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3F9EF2225E for ; Mon, 16 Nov 2020 21:56:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728575AbgKPVzt (ORCPT ); Mon, 16 Nov 2020 16:55:49 -0500 Received: from smtprelay0004.hostedemail.com ([216.40.44.4]:39678 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727864AbgKPVzs (ORCPT ); Mon, 16 Nov 2020 16:55:48 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay01.hostedemail.com (Postfix) with ESMTP id A099A100E7B49; Mon, 16 Nov 2020 21:55:46 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: sky93_41062bc2732c X-Filterd-Recvd-Size: 2867 Received: from XPS-9350.home (unknown [47.151.133.149]) (Authenticated sender: joe@perches.com) by omf13.hostedemail.com (Postfix) with ESMTPA; Mon, 16 Nov 2020 21:55:45 +0000 (UTC) Message-ID: Subject: Re: [PATCH v2] checkpatch: add fix option for MAINTAINERS_STYLE From: Joe Perches To: Aditya Srivastava Cc: linux-kernel-mentees@lists.linuxfoundation.org, linux-kernel@vger.kernel.org, lukas.bulwahn@gmail.com Date: Mon, 16 Nov 2020 13:55:44 -0800 In-Reply-To: <20201116071930.7733-1-yashsri421@gmail.com> References: <20201116071930.7733-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 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; > + } >   } >   } >   }