[PATCH] checkpatch: add Assisted-by tag

Shashank Balaji posted 1 patch 2 months ago
scripts/checkpatch.pl | 176 ++++++++++++++++++++++++++------------------------
1 file changed, 91 insertions(+), 85 deletions(-)
[PATCH] checkpatch: add Assisted-by tag
Posted by Shashank Balaji 2 months ago
Assisted-by tag is mentioned in coding-assistants.rst and submitting-patches.rst,
but checkpatch still complains about it, so fix it.

Email check is refactored into a function, and it's skipped for Assisted-by.
No syntax check is added for Assisted-by, but it may be added in the future
to enforce the format specified in coding-assistants.rst:

	Assisted-by: AGENT_NAME:MODEL_VERSION [TOOL1] [TOOL2]

Assisted-by: Claude:claude-4.6-sonnet
Acked-by: Rahul Bukte <rahul.bukte@sony.com>
Signed-off-by: Shashank Balaji <shashank.mahadasyam@sony.com>
---
 scripts/checkpatch.pl | 176 ++++++++++++++++++++++++++------------------------
 1 file changed, 91 insertions(+), 85 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e56374662ff7..a98b3c4f40e3 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -636,6 +636,7 @@ our $allocFunctions = qr{(?x:
 our $signature_tags = qr{(?xi:
 	Signed-off-by:|
 	Co-developed-by:|
+	Assisted-by:|
 	Acked-by:|
 	Tested-by:|
 	Reviewed-by:|
@@ -737,7 +738,7 @@ sub find_standard_signature {
 	my ($sign_off) = @_;
 	my @standard_signature_tags = (
 		'Signed-off-by:', 'Co-developed-by:', 'Acked-by:', 'Tested-by:',
-		'Reviewed-by:', 'Reported-by:', 'Suggested-by:'
+		'Reviewed-by:', 'Reported-by:', 'Suggested-by:', 'Assisted-by:'
 	);
 	foreach my $signature (@standard_signature_tags) {
 		return $signature if (get_edit_distance($sign_off, $signature) <= 2);
@@ -2649,6 +2650,94 @@ sub is_userspace {
     return ($realfile =~ m@^tools/@ || $realfile =~ m@^scripts/@);
 }
 
+sub check_sign_off_email {
+	my ($email, $herecurr) = @_;
+	my ($email_name, $name_comment, $email_address, $comment) = parse_email($email);
+	my $suggested_email = format_email(($email_name, $name_comment, $email_address, $comment));
+	if ($suggested_email eq "") {
+		ERROR("BAD_SIGN_OFF",
+		      "Unrecognized email address: '$email'\n" . $herecurr);
+	} else {
+		my $dequoted = $suggested_email;
+		$dequoted =~ s/^"//;
+		$dequoted =~ s/" </ </;
+		# Don't force email to have quotes
+		# Allow just an angle bracketed address
+		if (!same_email_addresses($email, $suggested_email)) {
+			if (WARN("BAD_SIGN_OFF",
+				 "email address '$email' might be better as '$suggested_email'\n" . $herecurr) &&
+			    $fix) {
+				$fixed[$fixlinenr] =~ s/\Q$email\E/$suggested_email/;
+			}
+		}
+
+		# Address part shouldn't have comments
+		my $stripped_address = $email_address;
+		$stripped_address =~ s/\([^\(\)]*\)//g;
+		if ($email_address ne $stripped_address) {
+			if (WARN("BAD_SIGN_OFF",
+				 "address part of email should not have comments: '$email_address'\n" . $herecurr) &&
+			    $fix) {
+				$fixed[$fixlinenr] =~ s/\Q$email_address\E/$stripped_address/;
+			}
+		}
+
+		# Only one name comment should be allowed
+		my $comment_count = () = $name_comment =~ /\([^\)]+\)/g;
+		if ($comment_count > 1) {
+			WARN("BAD_SIGN_OFF",
+			     "Use a single name comment in email: '$email'\n" . $herecurr);
+		}
+
+
+		# stable@vger.kernel.org or stable@kernel.org shouldn't
+		# have an email name. In addition comments should strictly
+		# begin with a #
+		if ($email =~ /^.*stable\@(?:vger\.)?kernel\.org/i) {
+			if (($comment ne "" && $comment !~ /^#.+/) ||
+			    ($email_name ne "")) {
+				my $cur_name = $email_name;
+				my $new_comment = $comment;
+				$cur_name =~ s/[a-zA-Z\s\-\"]+//g;
+
+				# Remove brackets enclosing comment text
+				# and # from start of comments to get comment text
+				$new_comment =~ s/^\((.*)\)$/$1/;
+				$new_comment =~ s/^\[(.*)\]$/$1/;
+				$new_comment =~ s/^[\s\#]+|\s+$//g;
+
+				$new_comment = trim("$new_comment $cur_name") if ($cur_name ne $new_comment);
+				$new_comment = " # $new_comment" if ($new_comment ne "");
+				my $new_email = "$email_address$new_comment";
+
+				if (WARN("BAD_STABLE_ADDRESS_STYLE",
+					 "Invalid email format for stable: '$email', prefer '$new_email'\n" . $herecurr) &&
+				    $fix) {
+					$fixed[$fixlinenr] =~ s/\Q$email\E/$new_email/;
+				}
+			}
+		} elsif ($comment ne "" && $comment !~ /^(?:#.+|\(.+\))$/) {
+			my $new_comment = $comment;
+
+			# Extract comment text from within brackets or
+			# c89 style /*...*/ comments
+			$new_comment =~ s/^\[(.*)\]$/$1/;
+			$new_comment =~ s/^\/\*(.*)\*\/$/$1/;
+
+			$new_comment = trim($new_comment);
+			$new_comment =~ s/^[^\w]$//; # Single lettered comment with non word character is usually a typo
+			$new_comment = "($new_comment)" if ($new_comment ne "");
+			my $new_email = format_email($email_name, $name_comment, $email_address, $new_comment);
+
+			if (WARN("BAD_SIGN_OFF",
+				 "Unexpected content after email: '$email', should be: '$new_email'\n" . $herecurr) &&
+			    $fix) {
+				$fixed[$fixlinenr] =~ s/\Q$email\E/$new_email/;
+			}
+		}
+	}
+}
+
 sub process {
 	my $filename = shift;
 
@@ -3105,90 +3194,7 @@ sub process {
 				}
 			}
 
-			my ($email_name, $name_comment, $email_address, $comment) = parse_email($email);
-			my $suggested_email = format_email(($email_name, $name_comment, $email_address, $comment));
-			if ($suggested_email eq "") {
-				ERROR("BAD_SIGN_OFF",
-				      "Unrecognized email address: '$email'\n" . $herecurr);
-			} else {
-				my $dequoted = $suggested_email;
-				$dequoted =~ s/^"//;
-				$dequoted =~ s/" </ </;
-				# Don't force email to have quotes
-				# Allow just an angle bracketed address
-				if (!same_email_addresses($email, $suggested_email)) {
-					if (WARN("BAD_SIGN_OFF",
-						 "email address '$email' might be better as '$suggested_email'\n" . $herecurr) &&
-					    $fix) {
-						$fixed[$fixlinenr] =~ s/\Q$email\E/$suggested_email/;
-					}
-				}
-
-				# Address part shouldn't have comments
-				my $stripped_address = $email_address;
-				$stripped_address =~ s/\([^\(\)]*\)//g;
-				if ($email_address ne $stripped_address) {
-					if (WARN("BAD_SIGN_OFF",
-						 "address part of email should not have comments: '$email_address'\n" . $herecurr) &&
-					    $fix) {
-						$fixed[$fixlinenr] =~ s/\Q$email_address\E/$stripped_address/;
-					}
-				}
-
-				# Only one name comment should be allowed
-				my $comment_count = () = $name_comment =~ /\([^\)]+\)/g;
-				if ($comment_count > 1) {
-					WARN("BAD_SIGN_OFF",
-					     "Use a single name comment in email: '$email'\n" . $herecurr);
-				}
-
-
-				# stable@vger.kernel.org or stable@kernel.org shouldn't
-				# have an email name. In addition comments should strictly
-				# begin with a #
-				if ($email =~ /^.*stable\@(?:vger\.)?kernel\.org/i) {
-					if (($comment ne "" && $comment !~ /^#.+/) ||
-					    ($email_name ne "")) {
-						my $cur_name = $email_name;
-						my $new_comment = $comment;
-						$cur_name =~ s/[a-zA-Z\s\-\"]+//g;
-
-						# Remove brackets enclosing comment text
-						# and # from start of comments to get comment text
-						$new_comment =~ s/^\((.*)\)$/$1/;
-						$new_comment =~ s/^\[(.*)\]$/$1/;
-						$new_comment =~ s/^[\s\#]+|\s+$//g;
-
-						$new_comment = trim("$new_comment $cur_name") if ($cur_name ne $new_comment);
-						$new_comment = " # $new_comment" if ($new_comment ne "");
-						my $new_email = "$email_address$new_comment";
-
-						if (WARN("BAD_STABLE_ADDRESS_STYLE",
-							 "Invalid email format for stable: '$email', prefer '$new_email'\n" . $herecurr) &&
-						    $fix) {
-							$fixed[$fixlinenr] =~ s/\Q$email\E/$new_email/;
-						}
-					}
-				} elsif ($comment ne "" && $comment !~ /^(?:#.+|\(.+\))$/) {
-					my $new_comment = $comment;
-
-					# Extract comment text from within brackets or
-					# c89 style /*...*/ comments
-					$new_comment =~ s/^\[(.*)\]$/$1/;
-					$new_comment =~ s/^\/\*(.*)\*\/$/$1/;
-
-					$new_comment = trim($new_comment);
-					$new_comment =~ s/^[^\w]$//; # Single lettered comment with non word character is usually a typo
-					$new_comment = "($new_comment)" if ($new_comment ne "");
-					my $new_email = format_email($email_name, $name_comment, $email_address, $new_comment);
-
-					if (WARN("BAD_SIGN_OFF",
-						 "Unexpected content after email: '$email', should be: '$new_email'\n" . $herecurr) &&
-					    $fix) {
-						$fixed[$fixlinenr] =~ s/\Q$email\E/$new_email/;
-					}
-				}
-			}
+			check_sign_off_email($email, $herecurr) if $sign_off !~ /^assisted-by:$/i;
 
 # Check for duplicate signatures
 			my $sig_nospace = $line;

---
base-commit: 3cd8b194bf3428dfa53120fee47e827a7c495815
change-id: 20260417-add-assisted-by-to-checkpatch-3a9d39487623

Best regards,
--  
Shashank Balaji <shashank.mahadasyam@sony.com>
Re: [PATCH] checkpatch: add Assisted-by tag
Posted by Joe Perches 2 months ago
On Fri, 2026-04-17 at 11:18 +0900, Shashank Balaji wrote:
> Assisted-by tag is mentioned in coding-assistants.rst and submitting-patches.rst,
> but checkpatch still complains about it, so fix it.

Already done in another patch.