lkml.org 
[lkml]   [2020]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3] checkpatch: add warning for lines starting with a '#' in commit log
From
Date
On Thu, 2020-12-03 at 02:27 +0530, Dwaipayan Ray wrote:
> Commit log lines starting with '#' are dropped by git as comments.
> Add a check to emit a warning for these lines.
>
> Also add a --fix option to insert a space before the leading '#' in
> such lines.
>
> Suggested-by: Joe Perches <joe@perches.com>
> Suggested-by: Peilin Ye <yepeilin.cs@gmail.com>
> Tested-by: Peilin Ye <yepeilin.cs@gmail.com>
> Signed-off-by: Dwaipayan Ray <dwaipayanray1@gmail.com>

Acked-by: Joe Perches <joe@perches.com>

> ---
> Changes in v3:
> - Modify commit message for more clarity
> - Modify warning message
> - Modify --fix option to substitute single space instead of tab
>
> Changes in v2:
> - Modify warning message and type
> - Style fixes
>
>  scripts/checkpatch.pl | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index e8c1ed0b1fad..7940889877ba 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2966,6 +2966,15 @@ sub process {
>   $commit_log_possible_stack_dump = 0;
>   }
>  
>
> +# Check for lines starting with a #
> + if ($in_commit_log && $line =~ /^#/) {
> + if (WARN("COMMIT_COMMENT_SYMBOL",
> + "Commit log lines starting with '#' are dropped by git as comments\n" . $herecurr) &&
> + $fix) {
> + $fixed[$fixlinenr] =~ s/^/ /;
> + }
> + }
> +
>  # Check for git id commit length and improperly formed commit descriptions
>   if ($in_commit_log && !$commit_log_possible_stack_dump &&
>   $line !~ /^\s*(?:Link|Patchwork|http|https|BugLink|base-commit):/i &&


\
 
 \ /
  Last update: 2020-12-02 22:04    [W:0.038 / U:0.456 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site