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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 13727C388F9 for ; Fri, 23 Oct 2020 20:19:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A85DA20780 for ; Fri, 23 Oct 2020 20:19:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756016AbgJWUTJ (ORCPT ); Fri, 23 Oct 2020 16:19:09 -0400 Received: from smtprelay0104.hostedemail.com ([216.40.44.104]:46266 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756008AbgJWUTJ (ORCPT ); Fri, 23 Oct 2020 16:19:09 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay02.hostedemail.com (Postfix) with ESMTP id DD4F21730851; Fri, 23 Oct 2020 20:19:07 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: thing33_0e181ed2725c X-Filterd-Recvd-Size: 2638 Received: from XPS-9350.home (unknown [47.151.133.149]) (Authenticated sender: joe@perches.com) by omf08.hostedemail.com (Postfix) with ESMTPA; Fri, 23 Oct 2020 20:19:06 +0000 (UTC) Message-ID: Subject: Re: [PATCH v3] checkpatch: fix false positives in REPEATED_WORD warning From: Joe Perches To: Lukas Bulwahn , Aditya Srivastava Cc: linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, dwaipayanray1@gmail.com Date: Fri, 23 Oct 2020 13:19:05 -0700 In-Reply-To: References: <20201023133828.19609-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: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2020-10-23 at 21:06 +0200, Lukas Bulwahn wrote: > On Fri, 23 Oct 2020, Aditya Srivastava wrote: > > A quick evaluation on v5.6..v5.8 showed that this fix reduces > > REPEATED_WORD warnings from 2797 to 907. > > > > A quick manual check found all cases are related to hex output or > > list command outputs in commit messages. [] > I think this strategy now makes sense and has the right complexity for a > good heuristics in this case. The proper indentation was not followed as described in a previous reply. This patch also causes conflicts with Dwaipayan's earlier effort. Lastly, I'm not sure this complexity is worthwhile. The style is also somewhat complex and doesn't allow for upper and lower case variants. I still think that a trivial "is $first hex only" test is simpler. Perhaps use a hash and an exists test if this is useful at all. What specific matches were found with this word list? Why not just add those to the word list? In all the nearly 1 million commit descriptions in the kernel without the patch contexts, these were the only hex-like word matches I found with their count of matches: 76 be 17 Add 13 add 6 dada 2 Bad 2 bad 100 or so false positives in about a million commits isn't many. dada is not an actual word in a commit message so I suggest adding hex word like checks only for "be" "add" and "bad". Maybe "added" too but that hasn't been used as far as I can tell. But all the other dictionary entries don't appear to be useful. So maybe something like: our %allow_repeated_words = ( add => '', added => '', bad => '', be => '', ); and next if (exists($allow_repeated_words{lc($first)}));