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=-14.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 5D738C433E7 for ; Sun, 18 Oct 2020 18:13:33 +0000 (UTC) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B112F21655 for ; Sun, 18 Oct 2020 18:13:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B112F21655 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-kernel-mentees-bounces@lists.linuxfoundation.org Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 46C92228CA; Sun, 18 Oct 2020 18:13:32 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HjzncfR2-aov; Sun, 18 Oct 2020 18:13:31 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 0B1CA20514; Sun, 18 Oct 2020 18:13:31 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id DE348C088B; Sun, 18 Oct 2020 18:13:30 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id CFDFCC0051 for ; Sun, 18 Oct 2020 18:13:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id C7A7E8761E for ; Sun, 18 Oct 2020 18:13:29 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7Ds1MJWeI7PX for ; Sun, 18 Oct 2020 18:13:28 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtprelay.hostedemail.com (smtprelay0140.hostedemail.com [216.40.44.140]) by whitealder.osuosl.org (Postfix) with ESMTPS id 8084E8761A for ; Sun, 18 Oct 2020 18:13:28 +0000 (UTC) Received: from smtprelay.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by smtpgrave03.hostedemail.com (Postfix) with ESMTP id 327BF181CA087 for ; Sun, 18 Oct 2020 18:04:19 +0000 (UTC) Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay04.hostedemail.com (Postfix) with ESMTP id 3CE92180A7FD6; Sun, 18 Oct 2020 18:04:16 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: face24_0c0baef27230 X-Filterd-Recvd-Size: 3782 Received: from XPS-9350.home (unknown [47.151.133.149]) (Authenticated sender: joe@perches.com) by omf17.hostedemail.com (Postfix) with ESMTPA; Sun, 18 Oct 2020 18:04:15 +0000 (UTC) Message-ID: From: Joe Perches To: Dwaipayan Ray , Andrew Morton Date: Sun, 18 Oct 2020 11:04:14 -0700 In-Reply-To: <20201017162732.152351-1-dwaipayanray1@gmail.com> References: <20201017162732.152351-1-dwaipayanray1@gmail.com> User-Agent: Evolution 3.36.4-0ubuntu1 MIME-Version: 1.0 Cc: linux-kernel-mentees@lists.linuxfoundation.org, linux-kernel@vger.kernel.org Subject: Re: [Linux-kernel-mentees] [PATCH v5] checkpatch: add new exception to repeated word check X-BeenThere: linux-kernel-mentees@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-kernel-mentees-bounces@lists.linuxfoundation.org Sender: "Linux-kernel-mentees" On Sat, 2020-10-17 at 21:57 +0530, Dwaipayan Ray wrote: > Recently, commit 4f6ad8aa1eac ("checkpatch: move repeated word test") > moved the repeated word test to check for more file types. But after > this, if checkpatch.pl is run on MAINTAINERS, it generates several > new warnings of the type: Andrew, can you pick this up please? Acked-by: Joe Perches > WARNING: Possible repeated word: 'git' > > For example: > WARNING: Possible repeated word: 'git' > +T: git git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml.git > > So, the pattern "git git://..." is a false positive in this case. > > There are several other combinations which may produce a wrong > warning message, such as "@size size", ":Begin begin", etc. > > Extend repeated word check to compare the characters before and > after the word matches. > > If there is a non whitespace character before the first word or a > non whitespace character excluding punctuation characters after > the second word, then the check is skipped and the warning is avoided. > > Also add case insensitive word matching to the repeated word check. > > Link: https://lore.kernel.org/linux-kernel-mentees/81b6a0bb2c7b9256361573f7a13201ebcd4876f1.camel@perches.com/ > Suggested-by: Joe Perches > Suggested-by: Lukas Bulwahn > Signed-off-by: Dwaipayan Ray > --- > scripts/checkpatch.pl | 15 +++++++++++++-- > 1 file changed, 13 insertions(+), 2 deletions(-) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index f1a4e61917eb..ec380626bebc 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -3052,19 +3052,30 @@ sub process { > > # check for repeated words separated by a single space > if ($rawline =~ /^\+/ || $in_commit_log) { > + pos($rawline) = 1 if (!$in_commit_log); > while ($rawline =~ /\b($word_pattern) (?=($word_pattern))/g) { > > my $first = $1; > my $second = $2; > - > + my $start_pos = $-[1]; > + my $end_pos = $+[2]; > if ($first =~ /(?:struct|union|enum)/) { > pos($rawline) += length($first) + length($second) + 1; > next; > } > > - next if ($first ne $second); > + next if (lc($first) ne lc($second)); > next if ($first eq 'long'); > > + # check for character before and after the word matches > + my $start_char = ''; > + my $end_char = ''; > + $start_char = substr($rawline, $start_pos - 1, 1) if ($start_pos > ($in_commit_log ? 0 : 1)); > + $end_char = substr($rawline, $end_pos, 1) if ($end_pos < length($rawline)); > + > + next if ($start_char =~ /^\S$/); > + next if (index(" \t.,;?!", $end_char) == -1); > + > if (WARN("REPEATED_WORD", > "Possible repeated word: '$first'\n" . $herecurr) && > $fix) { _______________________________________________ Linux-kernel-mentees mailing list Linux-kernel-mentees@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees