All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <jdelvare@suse.de>
To: Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 3/3] checkpatch: add 6 missing types to --list-types
Date: Sat, 2 Sep 2017 17:56:10 +0200	[thread overview]
Message-ID: <20170902175610.7e4a7c9d@endymion> (raw)
In-Reply-To: <20170902175111.2fcd9e85@endymion>

Unlike all other types, LONG_LINE, LONG_LINE_COMMENT and
LONG_LINE_STRING are passed to WARN() through a variable. This causes
the parser in list_types() to miss them and consequently they are not
present in the output of --list-types.

Additionally, types TYPO_SPELLING, FSF_MAILING_ADDRESS and AVOID_BUG
are passed with a variable level, causing the parser to miss them
too.

So modify the regex to also catch these special cases.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Fixes: 3beb42eced39 ("checkpatch: add --list-types to show message types to show or ignore")
Cc: Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>
---
 scripts/checkpatch.pl |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- linux-4.13-rc7.orig/scripts/checkpatch.pl	2017-09-02 17:46:45.852024037 +0200
+++ linux-4.13-rc7/scripts/checkpatch.pl	2017-09-02 17:46:55.925163818 +0200
@@ -145,7 +145,8 @@ sub list_types {
 	close($script);
 
 	my @types = ();
-	for ($text =~ /\b(?:(?:CHK|WARN|ERROR)\s*\(\s*"([^"]+)")/g) {
+	# Also catch when type or level is passed through a variable
+	for ($text =~ /(?:(?:\bCHK|\bWARN|\bERROR|&\{\$msg_level})\s*\(|\$msg_type\s*=)\s*"([^"]+)"/g) {
 		push (@types, $_);
 	}
 	@types = sort(uniq(@types));

-- 
Jean Delvare
SUSE L3 Support

  parent reply	other threads:[~2017-09-02 15:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-02 15:51 [PATCH 0/3] Add missing types to checkpatch.pl --list-types Jean Delvare
2017-09-02 15:52 ` [PATCH 1/3] checkpatch: fix typo in comment Jean Delvare
2017-09-02 15:53 ` [PATCH 2/3] checkpatch: rename variables to avoid confusion Jean Delvare
2017-09-02 15:56 ` Jean Delvare [this message]
2017-09-02 16:25 ` [PATCH 0/3] Add missing types to checkpatch.pl --list-types Joe Perches
2017-09-02 19:13   ` Jean Delvare
2017-09-02 21:03     ` Jean Delvare
2017-09-02 22:58       ` Joe Perches
2017-09-04  8:03         ` Jean Delvare

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=20170902175610.7e4a7c9d@endymion \
    --to=jdelvare@suse.de \
    --cc=apw@canonical.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.