[RFC PATCH 2/2] checkpatch: cosmetic-style tweak

Jim Cromie posted 2 patches 2 months ago
[RFC PATCH 2/2] checkpatch: cosmetic-style tweak
Posted by Jim Cromie 2 months ago
no functional change, slightly narrower on-screen, maybe clearer ?

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

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 27299f326804..4449e809ef6f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4019,11 +4019,13 @@ sub process {
 				if ($newindent ne $goodtabindent &&
 				    $newindent ne $goodspaceindent) {
 
-					if (CHK("PARENTHESIS_ALIGNMENT",
-						"Alignment should match open parenthesis\n" . $hereprev) &&
-					    $fix && $line =~ /^\+/) {
+					CHK("PARENTHESIS_ALIGNMENT",
+					    "Alignment should match open parenthesis\n" . $hereprev)
+					and do {
+					    if ($fix && $line =~ /^\+/) {
 						$fixed[$fixlinenr] =~
 						    s/^\+[ \t]*/\+$goodtabindent/;
+					    }
 					}
 				}
 			}
-- 
2.51.0
Re: [RFC PATCH 2/2] checkpatch: cosmetic-style tweak
Posted by Joe Perches 2 months ago
On Wed, 2025-10-15 at 11:51 -0600, Jim Cromie wrote:
> no functional change, slightly narrower on-screen, maybe clearer ?
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -4019,11 +4019,13 @@ sub process {
>  				if ($newindent ne $goodtabindent &&
>  				    $newindent ne $goodspaceindent) {
>  
> -					if (CHK("PARENTHESIS_ALIGNMENT",
> -						"Alignment should match open parenthesis\n" . $hereprev) &&
> -					    $fix && $line =~ /^\+/) {
> +					CHK("PARENTHESIS_ALIGNMENT",
> +					    "Alignment should match open parenthesis\n" . $hereprev)
> +					and do {
> +					    if ($fix && $line =~ /^\+/) {
>  						$fixed[$fixlinenr] =~
>  						    s/^\+[ \t]*/\+$goodtabindent/;
> +					    }

nack.

"and do" is not used anywhere by checkpatch
and I don't want to introduce it.