mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: SeongJae Park <sj38.park@gmail.com>
To: Joe Perches <joe@perches.com>
Cc: "SeongJae Park" <sj38.park@gmail.com>,
	"Michał Mirosław" <mirq-linux@rere.qmqm.pl>,
	"SeongJae Park" <sjpark@amazon.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, apw@canonical.com,
	colin.king@canonical.com, jslaby@suse.cz, pavel@ucw.cz,
	"SeongJae Park" <sjpark@amazon.de>
Subject: Re: Re: Re: Re: Re: checkpatch: support deprecated terms checking
Date: Sun, 26 Jul 2020 17:36:01 +0200	[thread overview]
Message-ID: <20200726153601.13855-1-sj38.park@gmail.com> (raw)
In-Reply-To: <dae471a789ee6e0bda5e641eb8e376fd03667415.camel@perches.com>

On Sun, 26 Jul 2020 07:50:54 -0700 Joe Perches <joe@perches.com> 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

  reply	other threads:[~2020-07-26 15:36 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11  6:25 [PATCH v4 0/2] Recommend denylist/allowlist instead of blacklist/whitelist SeongJae Park
2020-06-11  6:25 ` [PATCH v4 1/2] checkpatch: support deprecated terms checking SeongJae Park
2020-07-25 13:02   ` Michał Mirosław
2020-07-25 16:36     ` Joe Perches
2020-07-25 17:29     ` Joe Perches
2020-07-25 23:35       ` SeongJae Park
2020-07-26  4:27         ` Joe Perches
2020-07-26  7:18           ` SeongJae Park
2020-07-26  7:29             ` Joe Perches
2020-07-26  7:45               ` SeongJae Park
2020-07-26 14:50                 ` Joe Perches
2020-07-26 15:36                   ` SeongJae Park [this message]
2020-07-26 16:42                     ` Joe Perches
2020-07-26 18:07                       ` SeongJae Park
2020-07-26 20:33                         ` Michał Mirosław
2020-07-27  6:54                           ` SeongJae Park
2020-07-27 20:44                             ` Andrew Morton
2020-07-27 20:49                               ` Joe Perches
2020-07-28  6:22                                 ` SeongJae Park
2020-06-11  6:25 ` [PATCH v4 2/2] scripts/deprecated_terms: Recommend denylist/allowlist instead of blacklist/whitelist SeongJae Park
2020-06-11  6:35 ` [PATCH v4 0/2] " Joe Perches
2020-06-11  7:38   ` SeongJae Park
2020-06-11  8:16     ` Jiri Slaby
2020-06-11  8:30       ` SeongJae Park
2020-06-11  8:32         ` Jiri Slaby
2020-06-11 10:43           ` Joe Perches
2020-06-12  6:40             ` SeongJae Park
2020-06-12  7:05               ` Joe Perches
2020-06-12 14:40       ` Michael Ellerman
2020-06-14 21:29         ` Pavel Machek
2020-06-15  4:21           ` Jiri Slaby
2020-06-15  6:12             ` Pavel Machek
2020-06-15  6:46               ` SeongJae Park
2020-06-15  7:00                 ` Joe Perches
2020-06-15  7:39                   ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200726153601.13855-1-sj38.park@gmail.com \
    --to=sj38.park@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=colin.king@canonical.com \
    --cc=joe@perches.com \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=pavel@ucw.cz \
    --cc=sjpark@amazon.com \
    --cc=sjpark@amazon.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®