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);
                        }
                }
 

Reply via email to