[Linux-kernel-mentees] [PATCH v2] checkpatch: add warning for lines starting with a '#' in commit log

Joe Perches joe at perches.com
Wed Dec 2 20:36:57 UTC 2020


On Thu, 2020-12-03 at 01:52 +0530, Dwaipayan Ray wrote:
> Commit log lines starting with a '#' can be dropped by git if
> the corresponding commit message is reworded by a maintainer.
> This minor error can be easily avoided if checkpatch warns
> for the same.

This makes no sense to me.

How about:

Commit log lines starting with # are dropped by git as comments so
emit a warning for these comment lines.

Add a --fix option to insert a space before leading # comments

> +# Check for lines starting with a #
> +		if ($in_commit_log && $line =~ /^#/) {
> +			if (WARN("COMMIT_COMMENT_SYMBOL",
> +				 "Commit log lines starting with a '#' will be dropped by git as a comment\n" . $herecurr) &&

Perhaps:

				 "Commit log lines starting with '#' are dropped by git as comments\n" . $herecurr) &&

> +			    $fix) {
> +				$fixed[$fixlinenr] =~ s/^#/\t#/;

I suggest using a space char and not a tab to avoid excess indentation.

				$fixed[$fixlinenr] =~ s/^/ /;




More information about the Linux-kernel-mentees mailing list