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=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 94F2BC64E7B for ; Mon, 30 Nov 2020 18:01:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4B24B206F9 for ; Mon, 30 Nov 2020 18:01:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387863AbgK3SB4 (ORCPT ); Mon, 30 Nov 2020 13:01:56 -0500 Received: from smtprelay0169.hostedemail.com ([216.40.44.169]:57346 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387817AbgK3SB4 (ORCPT ); Mon, 30 Nov 2020 13:01:56 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay03.hostedemail.com (Postfix) with ESMTP id 0A3B6837F27B; Mon, 30 Nov 2020 18:01:15 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: fan15_5b14f8f273a3 X-Filterd-Recvd-Size: 3081 Received: from XPS-9350.home (unknown [47.151.128.180]) (Authenticated sender: joe@perches.com) by omf13.hostedemail.com (Postfix) with ESMTPA; Mon, 30 Nov 2020 18:01:13 +0000 (UTC) Message-ID: <40b6e1fa9fc638a7e755f7e91f401b6019fee2fa.camel@perches.com> Subject: Re: [PATCH] checkpatch: fix TYPO_SPELLING check for words with apostrophe From: Joe Perches To: Dwaipayan Ray Cc: linux-kernel-mentees@lists.linuxfoundation.org, linux-kernel , Lukas Bulwahn , Peilin Ye Date: Mon, 30 Nov 2020 10:01:12 -0800 In-Reply-To: References: <20201130144515.8320-1-dwaipayanray1@gmail.com> <070109a56817288562a91dfeec74359eb948234e.camel@perches.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 Mon, 2020-11-30 at 23:02 +0530, Dwaipayan Ray wrote: > Sorry I think i explained wrong. For words like "doesn't", it still > has the same problem. I think you explained it wrong when you didn't mention this is _only_ a problem when using --codespell. Likely it'd be better to use "(?:^|\s)($misspellings)(?=\s|$)" diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 7dc094445d83..b1783f02f745 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3106,7 +3106,7 @@ sub process { # Check for various typo / spelling mistakes if (defined($misspellings) && ($in_commit_log || $line =~ /^(?:\+|Subject:)/i)) { - while ($rawline =~ /(?:^|[^a-z@])($misspellings)(?:\b|$|[^a-z@])/gi) { + while ($rawline =~ /(?:^|\s)($misspellings)(?=\s|$)/gi) { my $typo = $1; my $typo_fix = $spelling_fix{lc($typo)}; $typo_fix = ucfirst($typo_fix) if ($typo =~ /^[A-Z]/); $ cat t_spell.c // SPDX-License-Identifier: GPL-2.0-only void foo(void) { //misspelled doesn' doesn't arne't word } $ ./scripts/checkpatch.pl -f --strict t_spell.c --codespell --codespellfile /usr/lib/python3/dist-packages/codespell_lib/data/dictionary.txt CHECK: 'doesn'' may be misspelled - perhaps 'doesn't'? #4: FILE: t_spell.c:4: + //misspelled doesn' doesn't arne't word CHECK: 'arne't' may be misspelled - perhaps 'aren't'? #4: FILE: t_spell.c:4: + //misspelled doesn' doesn't arne't word total: 0 errors, 0 warnings, 2 checks, 5 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. t_spell.c has style problems, please review. NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS.