All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Brauchli <a.brauchli@elementarea.net>
To: Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] checkpatch: allow URL >80 chars
Date: Fri, 17 Nov 2017 16:56:59 +0100	[thread overview]
Message-ID: <1510934219.2407.4.camel@elementarea.net> (raw)

Allow URL to exceed the 80 char limit for improved interaction in
adaption to ongoing but undocumented practice.

$ git grep -E '://\S{77}.*' -- '*.[ch]'

The patch checks that the URL is indeed on its own line in that it
allows a maximal prefix of 4 characters to account for a URL after a
comment (e.g. ' // https://...')

The URL format allows for up to 5 protocol characters before the
separator :// (e.g. https, git, ...). Additionally, an URL starting
with a "domain.tld" or "subdomain.domain" pattern (e.g.
'www.kernel.org') is also accepted.

$rawline is used in the check as comments are removed from $line.

Signed-off-by: Andreas Brauchli <andreas.brauchli@sensirion.com>
---
 scripts/checkpatch.pl | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 8b80bac055e4..aed447923354 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2904,6 +2904,11 @@ sub process {
 			} elsif ($line =~ /^\+.*\bEFI_GUID\s*\(/) {
 				$msg_type = "";
 
+			# URL (w/ minimal padding e.g. "+ // ")
+			} elsif ($rawline =~ /^\+.*?\b((?:\w{1,5}:\/\/|\w+\.\w+)\S+).*$/ &&
+				 length($rawline) - length($1) <= 5) {
+				$msg_type = "";
+
 			# Otherwise set the alternate message types
 
 			# a comment starts before $max_line_length
-- 
2.14.1

             reply	other threads:[~2017-11-17 15:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-17 15:56 Andreas Brauchli [this message]
2017-11-18  5:21 ` [PATCH] checkpatch: allow URL >80 chars Joe Perches
2017-11-18 10:07   ` Andreas Brauchli
2017-11-18 14:39     ` Joe Perches

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=1510934219.2407.4.camel@elementarea.net \
    --to=a.brauchli@elementarea.net \
    --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.