Re: [PATCH] checkpatch: Warn when a patch doesn't have a description
From: Joe Perches
Date: Thu Jul 26 2018 - 21:33:59 EST
On Thu, 2018-07-26 at 15:08 -0700, Andrew Morton wrote:
> On Wed, 25 Jul 2018 19:22:47 -0700 Joe Perches <joe@xxxxxxxxxxx> wrote:
>
> > Potential patches should have a commit description.
> > Emit a warning when there isn't one.
[]
> I did this:
>
> --- a/scripts/checkpatch.pl~checkpatch-warn-when-a-patch-doesnt-have-a-description-fix
> +++ a/scripts/checkpatch.pl
> @@ -2517,7 +2517,7 @@ sub process {
> if ($line !~ /^\s*$/) {
> $commit_log_lines++; #could be a $signature
> }
> - } else if ($has_commit_log && $commit_log_lines < 2) {
> + } elsif ($has_commit_log && $commit_log_lines < 2) {
> WARN("COMMIT_MESSAGE",
> "Missing commit description - Add an appropriate one\n");
> $commit_log_lines = 2; #warn only once
>
> But I worry that you didn't send out the version which you tested, so
> please check.
You're right, I inserted the wrong one.
Anyway, what you did is correct and that was the only change.
Thanks.
$ diff -urN cp_commit_log_lines.diff cp_commit_message.diff
--- cp_commit_log_lines.diff 2018-07-13 17:06:29.115337477 -0700
+++ cp_commit_message.diff 2018-07-15 05:46:29.878805336 -0700
@@ -2,7 +2,7 @@
1 file changed, 13 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
-index b5c875d7132b..8b5f3dae31c9 100755
+index b5c875d7132b..4ccf84079ea4 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2240,6 +2240,7 @@ sub process {
@@ -23,7 +23,7 @@
+ if ($line !~ /^\s*$/) {
+ $commit_log_lines++; #could be a $signature
+ }
-+ } else if ($has_commit_log && $commit_log_lines < 2) {
++ } elsif ($has_commit_log && $commit_log_lines < 2) {
+ WARN("COMMIT_MESSAGE",
+ "Missing commit description - Add an appropriate one\n");
+ $commit_log_lines = 2; #warn only once