All of lore.kernel.org
 help / color / mirror / Atom feed
* [Linux-kernel-mentees] [PATCH RFC] checkpatch: add warning for lines starting with a '#' in commit log
@ 2020-12-01 15:52 Dwaipayan Ray
  2020-12-01 17:49 ` Peilin Ye
  2020-12-01 17:58 ` Peilin Ye
  0 siblings, 2 replies; 5+ messages in thread
From: Dwaipayan Ray @ 2020-12-01 15:52 UTC (permalink / raw)
  To: lukas.bulwahn; +Cc: dwaipayanray1, linux-kernel-mentees, Peilin Ye

Commit log lines starting with a '#' can be ignored by git if the
corresponding commit message is reworded by a maintainer using
git commit --ammend. This minute error can be easily avoided if
checkpatch warns for the same.

Add a new check which emits a warning on finding lines starting with
a '#'. Also add a quick fix by adding a tab infront of such lines.

Suggested-by: Peilin Ye <yepeilin.cs@gmail.com>
Signed-off-by: Dwaipayan Ray <dwaipayanray1@gmail.com>
---
 scripts/checkpatch.pl | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index dabe39ca819e..10665b9a3d77 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 an #
+		if ($in_commit_log && $line =~ /^#/) {
+			if (WARN("POSSIBLE_IGNORED_LINE",
+				 "Commit log lines starting with a '#' might be ignored if the commit message is reworded using git commit --ammend.\n" . $herecurr)
+			    && $fix) {
+				$fixed[$fixlinenr] =~ s/^#/\t#/;
+			}
+		}
+
 # 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 &&
-- 
2.27.0

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Linux-kernel-mentees] [PATCH RFC] checkpatch: add warning for lines starting with a '#' in commit log
  2020-12-01 15:52 [Linux-kernel-mentees] [PATCH RFC] checkpatch: add warning for lines starting with a '#' in commit log Dwaipayan Ray
@ 2020-12-01 17:49 ` Peilin Ye
  2020-12-01 18:06   ` Dwaipayan Ray
  2020-12-01 17:58 ` Peilin Ye
  1 sibling, 1 reply; 5+ messages in thread
From: Peilin Ye @ 2020-12-01 17:49 UTC (permalink / raw)
  To: Dwaipayan Ray; +Cc: linux-kernel-mentees

On Tue, Dec 01, 2020 at 09:22:12PM +0530, Dwaipayan Ray wrote:
> Commit log lines starting with a '#' can be ignored by git if the
> corresponding commit message is reworded by a maintainer using
> git commit --ammend. This minute error can be easily avoided if

s/minute/minor/

> checkpatch warns for the same.
> 
> Add a new check which emits a warning on finding lines starting with
> a '#'. Also add a quick fix by adding a tab infront of such lines.

s/infront/in front/

> Suggested-by: Peilin Ye <yepeilin.cs@gmail.com>
> Signed-off-by: Dwaipayan Ray <dwaipayanray1@gmail.com>
> ---
>  scripts/checkpatch.pl | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index dabe39ca819e..10665b9a3d77 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 an #
> +		if ($in_commit_log && $line =~ /^#/) {
> +			if (WARN("POSSIBLE_IGNORED_LINE",
> +				 "Commit log lines starting with a '#' might be ignored if the commit message is reworded using git commit --ammend.\n" . $herecurr)

Also a nitpick, `commit --amend` isn't the only way to reword it, I did
it using `rebase -i`.

I think something like "Commit log lines starting with a '#' might be
dropped by git.\n" is sufficient, without being overspecific?

Otherwise,

Tested-by: Peilin Ye <yepeilin.cs@gmail.com>

Thank you,
Peilin Ye

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Linux-kernel-mentees] [PATCH RFC] checkpatch: add warning for lines starting with a '#' in commit log
  2020-12-01 15:52 [Linux-kernel-mentees] [PATCH RFC] checkpatch: add warning for lines starting with a '#' in commit log Dwaipayan Ray
  2020-12-01 17:49 ` Peilin Ye
@ 2020-12-01 17:58 ` Peilin Ye
  1 sibling, 0 replies; 5+ messages in thread
From: Peilin Ye @ 2020-12-01 17:58 UTC (permalink / raw)
  To: Dwaipayan Ray; +Cc: linux-kernel-mentees

On Tue, Dec 01, 2020 at 09:22:12PM +0530, Dwaipayan Ray wrote:
> Commit log lines starting with a '#' can be ignored by git if the
> corresponding commit message is reworded by a maintainer using
> git commit --ammend. This minute error can be easily avoided if

s/ammend/amend/

Thank you,
Peilin Ye

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Linux-kernel-mentees] [PATCH RFC] checkpatch: add warning for lines starting with a '#' in commit log
  2020-12-01 17:49 ` Peilin Ye
@ 2020-12-01 18:06   ` Dwaipayan Ray
  2020-12-01 18:08     ` Lukas Bulwahn
  0 siblings, 1 reply; 5+ messages in thread
From: Dwaipayan Ray @ 2020-12-01 18:06 UTC (permalink / raw)
  To: Peilin Ye; +Cc: linux-kernel-mentees

On Tue, Dec 1, 2020 at 11:19 PM Peilin Ye <yepeilin.cs@gmail.com> wrote:
>
> On Tue, Dec 01, 2020 at 09:22:12PM +0530, Dwaipayan Ray wrote:
> > Commit log lines starting with a '#' can be ignored by git if the
> > corresponding commit message is reworded by a maintainer using
> > git commit --ammend. This minute error can be easily avoided if
>
> s/minute/minor/
>
> > checkpatch warns for the same.
> >
> > Add a new check which emits a warning on finding lines starting with
> > a '#'. Also add a quick fix by adding a tab infront of such lines.
>
> s/infront/in front/
>
> > Suggested-by: Peilin Ye <yepeilin.cs@gmail.com>
> > Signed-off-by: Dwaipayan Ray <dwaipayanray1@gmail.com>
> > ---
> >  scripts/checkpatch.pl | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> >
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > index dabe39ca819e..10665b9a3d77 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 an #
> > +             if ($in_commit_log && $line =~ /^#/) {
> > +                     if (WARN("POSSIBLE_IGNORED_LINE",
> > +                              "Commit log lines starting with a '#' might be ignored if the commit message is reworded using git commit --ammend.\n" . $herecurr)
>
> Also a nitpick, `commit --amend` isn't the only way to reword it, I did
> it using `rebase -i`.
>
> I think something like "Commit log lines starting with a '#' might be
> dropped by git.\n" is sufficient, without being overspecific?

I think that might be better. I would probably add `dropped by git when
the commit message is reworded`. I totally forgot that rebase could also
do it. Thanks.

>
> Otherwise,
>
> Tested-by: Peilin Ye <yepeilin.cs@gmail.com>
>

Thanks for the feedback and the tag Peilin.
I will have these changes done.

If Lukas doesn't have any problem with this, I can send it to Joe then.

Thanks & Regards,
Dwaipayan.
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Linux-kernel-mentees] [PATCH RFC] checkpatch: add warning for lines starting with a '#' in commit log
  2020-12-01 18:06   ` Dwaipayan Ray
@ 2020-12-01 18:08     ` Lukas Bulwahn
  0 siblings, 0 replies; 5+ messages in thread
From: Lukas Bulwahn @ 2020-12-01 18:08 UTC (permalink / raw)
  To: Dwaipayan Ray; +Cc: linux-kernel-mentees, Peilin Ye

On Tue, Dec 1, 2020 at 7:06 PM Dwaipayan Ray <dwaipayanray1@gmail.com> wrote:
>
> On Tue, Dec 1, 2020 at 11:19 PM Peilin Ye <yepeilin.cs@gmail.com> wrote:
> >
> > On Tue, Dec 01, 2020 at 09:22:12PM +0530, Dwaipayan Ray wrote:
> > > Commit log lines starting with a '#' can be ignored by git if the
> > > corresponding commit message is reworded by a maintainer using
> > > git commit --ammend. This minute error can be easily avoided if
> >
> > s/minute/minor/
> >
> > > checkpatch warns for the same.
> > >
> > > Add a new check which emits a warning on finding lines starting with
> > > a '#'. Also add a quick fix by adding a tab infront of such lines.
> >
> > s/infront/in front/
> >
> > > Suggested-by: Peilin Ye <yepeilin.cs@gmail.com>
> > > Signed-off-by: Dwaipayan Ray <dwaipayanray1@gmail.com>
> > > ---
> > >  scripts/checkpatch.pl | 9 +++++++++
> > >  1 file changed, 9 insertions(+)
> > >
> > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > > index dabe39ca819e..10665b9a3d77 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 an #
> > > +             if ($in_commit_log && $line =~ /^#/) {
> > > +                     if (WARN("POSSIBLE_IGNORED_LINE",
> > > +                              "Commit log lines starting with a '#' might be ignored if the commit message is reworded using git commit --ammend.\n" . $herecurr)
> >
> > Also a nitpick, `commit --amend` isn't the only way to reword it, I did
> > it using `rebase -i`.
> >
> > I think something like "Commit log lines starting with a '#' might be
> > dropped by git.\n" is sufficient, without being overspecific?
>
> I think that might be better. I would probably add `dropped by git when
> the commit message is reworded`. I totally forgot that rebase could also
> do it. Thanks.
>
> >
> > Otherwise,
> >
> > Tested-by: Peilin Ye <yepeilin.cs@gmail.com>
> >
>
> Thanks for the feedback and the tag Peilin.
> I will have these changes done.
>
> If Lukas doesn't have any problem with this, I can send it to Joe then.
>

Looks good to me.

Lukas

> Thanks & Regards,
> Dwaipayan.
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-12-01 18:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-01 15:52 [Linux-kernel-mentees] [PATCH RFC] checkpatch: add warning for lines starting with a '#' in commit log Dwaipayan Ray
2020-12-01 17:49 ` Peilin Ye
2020-12-01 18:06   ` Dwaipayan Ray
2020-12-01 18:08     ` Lukas Bulwahn
2020-12-01 17:58 ` Peilin Ye

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.