Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp416106ybg; Sun, 26 Jul 2020 08:37:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGA1KCRiPB65W2gDhG0dDwf3GTrJEaR4fkV9xetctg9zyIEPTDnZ65mxB285bubkDCbl2a X-Received: by 2002:a05:6402:8d6:: with SMTP id d22mr10834324edz.285.1595777854219; Sun, 26 Jul 2020 08:37:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595777854; cv=none; d=google.com; s=arc-20160816; b=lvyeHbFt1iy7miKAF4zYmy9ts0HSLu78eKdYhYPApbs+LFYsmHslJJ2eiFdEBnp9vY yE/7mygErLAypkEDxjXyrPdnIcl5fS1WSGPj8oTS8MqNkq0qOI7/zpf6SgFfSYaJlNaS F3fKmV2yIDnOMqK6pD04EuVNJLoKMtj3Qx+uu1bEcshgY6Kc1Uf2OnEMBN5J8BNBjTHW U9iF89CcfyO0UVBJrAj0qt0Ra4CkKHTJi5d5q8mhzITSPGzF7c50AxXAUtv1NZXpIAV7 oMD7v9GP9keEeCw5AjLeemcEvonSKLt4fFs8ZGX9I8R8Mi/Dwi/nAbWjb5sxUMCgSmH4 fmAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HDG9/ek9z1S16A5dtxmL+5qh96r+OR3wdAt2UD99xf8=; b=SepJSTHI6PaA/DkURPsj3nb/eyvLpRJNbhCJdr9c+HeQuuKT2K8tfALlC5RhW/XS6w MkYzZMBOqQ+yWZkl5TZKYoLeMuGbDtYOEeh1a6hGLAQmeAzhoWnLnGd/xDt8IncHIH77 tExbfDiqFdKtU1OjT7WMUaCQ0JB0Qu7USNf0D+P5HBPxC+al2wsuD6cFXDmsYJ8piLgm 3PHQkzrJYrQmTPPRKVgGOoemjasKf/H+GYqxYele+7vG428CBXfzmmleee2c6NTHI66M EAYjgFcieFjGMQwHdcsdJNNFMRyTAxMR2ZaFzIFUXq/UViAs6LKP58CgNZ1WWzEYwZ2w 6bDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="AVo97B/a"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u11si4106048edy.592.2020.07.26.08.37.12; Sun, 26 Jul 2020 08:37:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="AVo97B/a"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727945AbgGZPgR (ORCPT + 99 others); Sun, 26 Jul 2020 11:36:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726668AbgGZPgQ (ORCPT ); Sun, 26 Jul 2020 11:36:16 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F5D1C0619D2 for ; Sun, 26 Jul 2020 08:36:16 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id kq25so1633104ejb.3 for ; Sun, 26 Jul 2020 08:36:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to; bh=HDG9/ek9z1S16A5dtxmL+5qh96r+OR3wdAt2UD99xf8=; b=AVo97B/a29T3cdG3nvRjJyvoj8+TvYxwL1F/zxvwaO6TPdrBJ32G2Su/QH8mD4pdP8 pA2xucxxTNYt2Y3YO3ew8gufRBE6xApEZM5JMV/fHqkcZTgoPHhfkcPEeSRojG8LikZr NNqOzQEcVFEm8gMTEWvgpdi4t5O13Pfq0cZ5S7jLckrltiI2+QxqkzpLlxd4sUvHksr8 kF6jA3C+oTJ5HshEHpFDBvdPzxaeOMrM6lTwczN8daJtagRzw9ONBpLqTOsv9ynDlpqu bUDKQn7Ofr+6yjhk+tuPU2JX00+9bDcdEZ3Cbbt+aG/MHpuVCNBB8KpSpUnlU6dNFjxj MrdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to; bh=HDG9/ek9z1S16A5dtxmL+5qh96r+OR3wdAt2UD99xf8=; b=hVHKBMFU/P1lMag6UdfmpEN5GPDDVochocyvLuzxE4lZCebYC+3n1Q/vDH0TmYGSRN Ex+y3DjeJ9xhAaVqaVb54+OGDT3JMZtfEwF2zPKdNA2WokqrPmgRfOrIOYG/VWAhbeBl Lq1sHne3nDZwfWJsqQxR1mJ99ZF0bmn7NG1EP811QmFLhXksBnoLqBYQOzsfw6hRQnPS U9uK5ATpy2/lYeJqvX9W7pVtuEKeOs9SSt42ejvfXrq54OWXdaGa058/DmkhtvUr/X+d R24X1/FBnT9Pt+t6B5RJN253DOMzMlePMzvZTe0ldls1vDGu67sIrM1AcMpk9e5bBOk/ zTwg== X-Gm-Message-State: AOAM532W3rCgT3HJgP5NGscsiC9mfG+BuLenycaJYo+i3vWghiJJ3Lj1 2BDIitYnfposmZnkI0/GHe8= X-Received: by 2002:a17:906:3e4f:: with SMTP id t15mr3529388eji.368.1595777775095; Sun, 26 Jul 2020 08:36:15 -0700 (PDT) Received: from localhost.localdomain ([2a02:2450:10d2:194d:60d3:6c2f:f9ba:e713]) by smtp.gmail.com with ESMTPSA id ay5sm216386edb.2.2020.07.26.08.36.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jul 2020 08:36:14 -0700 (PDT) From: SeongJae Park To: Joe Perches Cc: SeongJae Park , =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= , SeongJae Park , Andrew Morton , linux-kernel@vger.kernel.org, apw@canonical.com, colin.king@canonical.com, jslaby@suse.cz, pavel@ucw.cz, SeongJae Park Subject: Re: Re: Re: Re: Re: checkpatch: support deprecated terms checking Date: Sun, 26 Jul 2020 17:36:01 +0200 Message-Id: <20200726153601.13855-1-sj38.park@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 26 Jul 2020 07:50:54 -0700 Joe Perches wrote: > On Sun, 2020-07-26 at 09:45 +0200, SeongJae Park wrote: > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > [] > > @@ -721,6 +721,7 @@ sub read_word_corrections { > > my %deprecated_terms_fix; > > read_word_corrections($deprecated_terms_file, \%deprecated_terms_fix); > > my $deprecated_terms = join("|", sort keys %deprecated_terms_fix) if keys %deprecated_terms_fix; > > +my %deprecated_terms_reported = map { $_ => 1 } > > overly verbose naming and this doesn't need initialization here. > > > @@ -2975,13 +2976,16 @@ sub process { > > ($in_commit_log || $line =~ /^(?:\+|Subject:)/i)) { > > while ($rawline =~ /(?:^|[^a-z@])($deprecated_terms)(?:\b|$|[^a-z@])/gi) { > > my $deprecated_term = $1; > > + last if (exists($deprecated_terms_reported{$deprecated_term})); > > next if (...) to check if multiple terms exists on the same line Agreed on these comments, thanks! > > > + $deprecated_terms_reported{$deprecated_term} = 1; > > + > > But this does need to be reset to empty when checking the next file Hmm... I though you mean reporting same term multiple times too verbose... Did I misunderstand your point? > > > my $suggested = $deprecated_terms_fix{lc($deprecated_term)}; > > $suggested = ucfirst($suggested) if ($deprecated_term=~ /^[A-Z]/); > > $suggested = uc($suggested) if ($deprecated_term =~ /^[A-Z]+$/); > > my $msg_level = \&WARN; > > $msg_level = \&CHK if ($file); > > if (&{$msg_level}("DEPRECATED_TERM", > > - "Use of '$deprecated_term' is deprecated, please '$suggested', instead.\n" . $herecurr) && > > + "Use of '$deprecated_term' is controversial - if not required by specification, perhaps '$suggested' instead. See: scripts/deprecated_terms.txt\n" . $herecurr) && > > $fix) { > > $fixed[$fixlinenr] =~ s/(^|[^A-Za-z@])($deprecated_term)($|[^A-Za-z@])/$1$suggested$3/; > > I think it simpler to avoid emitting this on existing files. Agreed, it's much simpler. However, my concerns on excluding existing file checks are: 1. Avoiding existing file checks will still not stop warning patches mentioning existing deprecated terms. 2. If the term mistakenly comes in newly, it would be hard to check it later. 3. Some future deprecations of terms might be applied to existing uses, as 's/fuck/hug' did. > > I do not want to encourage relatively inexperienced people > to run checkpatch and submit inappropriate patches. Me, neither. But, I think providing more warnings and references is better for that. Experienced people would be able to easily ignore the false positives. Simply limiting checks could allow people submitting inappropriate patches intorducing new uses of deprecated terms. Thanks, SeongJae Park