mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: SeongJae Park <sjpark@amazon.com>,
	akpm@linux-foundation.org, apw@canonical.com
Cc: colin.king@canonical.com, sj38.park@gmail.com,
	linux-kernel@vger.kernel.org, SeongJae Park <sjpark@amazon.de>
Subject: Re: [PATCH v3 1/2] checkpatch: support deprecated terms checking
Date: Wed, 10 Jun 2020 00:13:42 -0700	[thread overview]
Message-ID: <016a2c771e5535a872b9f20d90e4cc5683ea7a55.camel@perches.com> (raw)
In-Reply-To: <20200610065223.29894-2-sjpark@amazon.com>

On Wed, 2020-06-10 at 08:52 +0200, SeongJae Park wrote:
> From: SeongJae Park <sjpark@amazon.de>
> 
> Some terms could be deprecated for various reasons, but it is hard to
> update the entire old usages.  That said, we could at least encourage
> new patches to use the suggested replacements.  This commit adds check
> of deprecated terms in the 'checkpatch.pl' for that.  The script will
> get deprecated terms and suggested replacements of those from
> 'scripts/deprecated_terms.txt' file and warn if the deprecated terms are
> used.  The mechanism and the format of the file are almost the same as
> that of 'spelling.txt'.
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> +# Load deprecated terms and build regular expression list.
> +my $deprecated_terms;
> +my %deprecated_terms_fix;
> +
> +if (open(my $deprecates, '<', $deprecated_terms_file)) {
> +	while (<$deprecates>) {
> +		my $line = $_;
> +
> +		$line =~ s/\s*\n?$//g;
> +		$line =~ s/^\s*//g;
> +
> +		next if ($line =~ m/^\s*#/);
> +		next if ($line =~ m/^\s*$/);
> +
> +		my ($suspect, $fix) = split(/\|\|/, $line);
> +
> +		$deprecated_terms_fix{$suspect} = $fix;
> +	}
> +	close($deprecates);
> +} else {
> +	warn "No deprecated term will be found - file '$deprecated_terms_file': $!\n";
> +}
> +
> +$deprecated_terms = join("|", sort keys %deprecated_terms_fix) if keys %deprecated_terms_fix;
> +

This is a direct copy of the spelling dictionary
loading code, so maybe these could be consolidated.



  reply	other threads:[~2020-06-10  7:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-10  6:52 [PATCH v3 0/2] Recommend blocklist/allowlist instead of blacklist/whitelist SeongJae Park
2020-06-10  6:52 ` [PATCH v3 1/2] checkpatch: support deprecated terms checking SeongJae Park
2020-06-10  7:13   ` Joe Perches [this message]
2020-06-10  8:01     ` SeongJae Park
2020-06-10  8:45       ` Joe Perches
2020-06-10  9:09         ` SeongJae Park
2020-06-10  6:52 ` [PATCH v3 2/2] scripts/deprecated_terms: Recommend blocklist/allowlist instead of blacklist/whitelist SeongJae Park
2020-06-10 13:54   ` SeongJae Park
2020-06-10  7:06 ` [PATCH v3 0/2] " Joe Perches
2020-06-14 21:15 ` 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=016a2c771e5535a872b9f20d90e4cc5683ea7a55.camel@perches.com \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=colin.king@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sj38.park@gmail.com \
    --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®