linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
From: Ujjwal Kumar <ujjwalkumar0501@gmail.com>
To: Joe Perches <joe@perches.com>, Lukas Bulwahn <lukas.bulwahn@gmail.com>
Cc: linux-kernel-mentees@lists.linuxfoundation.org,
	linux-kernel@vger.kernel.org,
	Ujjwal Kumar <ujjwalkumar0501@gmail.com>
Subject: [Linux-kernel-mentees] [PATCH] checkpatch: improve EXECUTE_PERMISSIONS tests
Date: Mon, 12 Oct 2020 20:46:30 +0530	[thread overview]
Message-ID: <20201012151628.1234094-1-ujjwalkumar0501@gmail.com> (raw)

1. Use group capture regexp for file mode test to improve code
   readability.

2. The 'scripts/' directory test on filenames can be excluded
   as it has become obsolete because there are many source
   files that are not scripts in this directory and its
   subdirectories.

3. Replace unnecessary group capture regexp with non-capturing
   group.

Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Ujjwal Kumar <ujjwalkumar0501@gmail.com>
---
 scripts/checkpatch.pl | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index fab38b493cef..aa84999917b5 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2678,10 +2678,11 @@ sub process {
 		}

 # Check for incorrect file permissions
-		if ($line =~ /^new (file )?mode.*[7531]\d{0,2}$/) {
+		if ($line =~ /^new (?:file )?mode (\d+)$/) {
+			my $mode = substr($1, -3);
 			my $permhere = $here . "FILE: $realfile\n";
-			if ($realfile !~ m@scripts/@ &&
-			    $realfile !~ /\.(py|pl|awk|sh)$/) {
+			if ($mode =~ /[1357]/ &&
+			    $realfile !~ /\.(?:py|pl|awk|sh)$/) {
 				ERROR("EXECUTE_PERMISSIONS",
 				      "do not set execute permissions for source files\n" . $permhere);
 			}

base-commit: d67bc7812221606e1886620a357b13f906814af7
--
2.26.2

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

                 reply	other threads:[~2020-10-12 15:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20201012151628.1234094-1-ujjwalkumar0501@gmail.com \
    --to=ujjwalkumar0501@gmail.com \
    --cc=joe@perches.com \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).