[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <58ed7006138bb256ad1821d5f4f892f3c3e031a8.camel@perches.com>
Date: Sat, 25 Jul 2020 10:29:23 -0700
From: Joe Perches <joe@...ches.com>
To: Michał Mirosław <mirq-linux@...e.qmqm.pl>,
SeongJae Park <sjpark@...zon.com>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
apw@...onical.com, colin.king@...onical.com, sj38.park@...il.com,
jslaby@...e.cz, pavel@....cz
Subject: Re: checkpatch: support deprecated terms checking
On Sat, 2020-07-25 at 15:02 +0200, Michał Mirosław wrote:
> Hello,
>
> I see that this patch went into next and is already inciting people to
> do wrong things [1]. Can you please fix it to require '--subjective'
> switch or otherwise mark it clearly as suggestion-only?
>
> The coding-style as in Linus' master says about *NEW* uses of the words
> listed (those introductions I expect to be actually rare) and not about
> existing use in the code or industry. Making a noise about all uses
> found surely will generate a lot more irrelevant patches.
>
> [1] https://www.spinics.net/lists/linux-tegra/msg51849.html
And if not reverted, perhaps do not check existing files
at all but only check patches and change the message to
show only suggestions not from a specification.
---
scripts/checkpatch.pl | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e9fde28eb0de..7ef1ba80cb20 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2970,21 +2970,16 @@ sub process {
}
}
-# Check for deprecated terms
- if (defined($deprecated_terms) &&
+# Check for deprecated terms not used by a specification (not used on files)
+ if (!$file && defined($deprecated_terms) &&
($in_commit_log || $line =~ /^(?:\+|Subject:)/i)) {
while ($rawline =~ /(?:^|[^a-z@])($deprecated_terms)(?:\b|$|[^a-z@])/gi) {
- my $deprecated_term = $1;
- 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) &&
- $fix) {
- $fixed[$fixlinenr] =~ s/(^|[^A-Za-z@])($deprecated_term)($|[^A-Za-z@])/$1$suggested$3/;
- }
+ my $deprecate = $1;
+ my $suggest = $deprecated_terms_fix{lc($deprecate)};
+ $suggest = ucfirst($suggest) if ($deprecate =~ /^[A-Z]/);
+ $suggest = uc($suggest) if ($deprecate =~ /^[A-Z]+$/);
+ CHK("DEPRECATED_TERM",
+ "Use of '$deprecate' is controversial - if not required by specification, perhaps '$suggest' instead\n" . $herecurr);
}
}
Powered by blists - more mailing lists