[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <016a2c771e5535a872b9f20d90e4cc5683ea7a55.camel@perches.com>
Date: Wed, 10 Jun 2020 00:13:42 -0700
From: Joe Perches <joe@...ches.com>
To: SeongJae Park <sjpark@...zon.com>, akpm@...ux-foundation.org,
apw@...onical.com
Cc: colin.king@...onical.com, sj38.park@...il.com,
linux-kernel@...r.kernel.org, SeongJae Park <sjpark@...zon.de>
Subject: Re: [PATCH v3 1/2] checkpatch: support deprecated terms checking
On Wed, 2020-06-10 at 08:52 +0200, SeongJae Park wrote:
> From: SeongJae Park <sjpark@...zon.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.
Powered by blists - more mailing lists