lkml.org 
[lkml]   [2017]   [Nov]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] checkpatch: allow URL >80 chars
From
Date
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
\
 
 \ /
  Last update: 2017-11-17 17:21    [W:0.056 / U:1.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site