[PATCH 1/2] checkpatch: tolerate long lines w/o spaces

Jim Cromie posted 2 patches 2 years ago
[PATCH 1/2] checkpatch: tolerate long lines w/o spaces
Posted by Jim Cromie 2 years ago
checkpatch complains about long lines (>75 chars), but allows a few
exceptions:

 file delta changes
 filename then :
 A Fixes:, link or signature tag line

Add another exception, to allow a long "word" without whitespace.  The
regex allows spaces in 1st 10 chars, so it allows the following [1],
which current checkpatch carps about.

[1] https://lore.kernel.org/lkml/20200825153338.17061-1-vincent.whitchurch@axis.com

Dummy-tag: test-generic-tag-format-with-url-length-bla-bla-jeez-dont-give-up-now-there.

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
 scripts/checkpatch.pl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 9c4c4a61bc83..dc17c6da3af2 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3271,6 +3271,8 @@ sub process {
 					# filename then :
 		      $line =~ /^\s*(?:Fixes:|$link_tags_search|$signature_tags)/i ||
 					# A Fixes:, link or signature tag line
+		      $line =~ /^.{10}\S+$/ ||
+					# a long single "word" without whitespace
 		      $commit_log_possible_stack_dump)) {
 			WARN("COMMIT_LOG_LONG_LINE",
 			     "Prefer a maximum 75 chars per line (possible unwrapped commit description?)\n" . $herecurr);
-- 
2.43.0
Re: [PATCH 1/2] checkpatch: tolerate long lines w/o spaces
Posted by Joe Perches 2 years ago
On Sat, 2024-02-03 at 12:55 -0700, Jim Cromie wrote:
> checkpatch complains about long lines (>75 chars), but allows a few
> exceptions:
> 
>  file delta changes
>  filename then :
>  A Fixes:, link or signature tag line
> 
> Add another exception, to allow a long "word" without whitespace.  The
> regex allows spaces in 1st 10 chars, so it allows the following [1],
> which current checkpatch carps about.
> 
> [1] https://lore.kernel.org/lkml/20200825153338.17061-1-vincent.whitchurch@axis.com
> 
> Dummy-tag: test-generic-tag-format-with-url-length-bla-bla-jeez-dont-give-up-now-there.
> 
> Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
> ---
>  scripts/checkpatch.pl | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 9c4c4a61bc83..dc17c6da3af2 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -3271,6 +3271,8 @@ sub process {
>  					# filename then :
>  		      $line =~ /^\s*(?:Fixes:|$link_tags_search|$signature_tags)/i ||
>  					# A Fixes:, link or signature tag line
> +		      $line =~ /^.{10}\S+$/ ||
> +					# a long single "word" without whitespace

Perhaps better would be
		      $line =! /^(?:\S+\s+)?\S+$/ ||

	
>  		      $commit_log_possible_stack_dump)) {
>  			WARN("COMMIT_LOG_LONG_LINE",
>  			     "Prefer a maximum 75 chars per line (possible unwrapped commit description?)\n" . $herecurr);