[Linux-kernel-mentees] [PATCH] checkpatch: add fix option for ERROR:GERRIT_CHANGE_ID

Lukas Bulwahn lukas.bulwahn at gmail.com
Fri Oct 30 10:45:14 UTC 2020


I would drop the ERROR:, just say: add fix option for GERRIT_CHANGE_ID

On Fri, 30 Oct 2020, Aditya Srivastava wrote:

> Currently, whenever gerrit change id is present in commit, checkpatch.pl
...whenever a Gerrir Change-Id is present in a commit,

> gives an error to remove the change id before submitting the patch.
>
s/gives an error/warns/
s/change id/Change-Id/
 
> For eg, running checkpatch on commit adc311a5bbf6 ("iwlwifi: bump FW

Just: "E.g.," not "For eg"
 
> API to 53 for 22000 series"), causes error:

s/causes error/reports this error/

> 
> ERROR:GERRIT_CHANGE_ID: Remove Gerrit Change-Id's before submitting
> upstream
> Change-Id: I5725e46394f3f53c3069723fd513cc53c7df383d
>

The default setup does not show the type name, I would suggest to just 
show the default output from checkpatch.pl.
 
> But there is no --fix option present for this error message, in case
> user wants to fix it immediately.
> 
> To fix this error, delete the corresponding line from the patchfile when
> checkpatch.pl is executed with --fix
> 

Provide a simple fix option by simply deleting the indicated line.

> Signed-off-by: Aditya Srivastava <yashsri421 at gmail.com>
> ---
>  scripts/checkpatch.pl | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 7800a090e8fe..5329927fc1c1 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2852,8 +2852,11 @@ sub process {
>  
>  # Check for Gerrit Change-Ids not in any patch context
>  		if ($realfile eq '' && !$has_patch_separator && $line =~ /^\s*change-id:/i) {
> -			ERROR("GERRIT_CHANGE_ID",
> -			      "Remove Gerrit Change-Id's before submitting upstream\n" . $herecurr);
> +			if (ERROR("GERRIT_CHANGE_ID",
> +			          "Remove Gerrit Change-Id's before submitting upstream\n" . $herecurr) &&
> +			    $fix) {
> +                                fix_delete_line($fixlinenr, $rawline);
> +                        }

The change itself looks good to me.

Rework the commit message, send it out again here for a second check and 
if it is fine then you can submit it to Joe and lkml.
>  		}
>  
>  # Check if the commit log is in a possible stack dump
> -- 
> 2.17.1
> 
> 


More information about the Linux-kernel-mentees mailing list