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

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.

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

Suggested-by: Peilin Ye <yepeilin.cs@gmail.com>
Tested-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 e8c1ed0b1fad..a12edcf4f63a 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("POSSIBLE_IGNORED_LINE",
+				 "Commit log lines starting with a '#' might be dropped by git.\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


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

* [Linux-kernel-mentees] [PATCH] checkpatch: add warning for lines starting with a '#' in commit log
@ 2020-12-02 10:14 ` Dwaipayan Ray
  0 siblings, 0 replies; 6+ messages in thread
From: Dwaipayan Ray @ 2020-12-02 10:14 UTC (permalink / raw)
  To: joe; +Cc: Peilin Ye, dwaipayanray1, linux-kernel-mentees, linux-kernel

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.

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

Suggested-by: Peilin Ye <yepeilin.cs@gmail.com>
Tested-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 e8c1ed0b1fad..a12edcf4f63a 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("POSSIBLE_IGNORED_LINE",
+				 "Commit log lines starting with a '#' might be dropped by git.\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] 6+ messages in thread

* Re: [PATCH] checkpatch: add warning for lines starting with a '#' in commit log
  2020-12-02 10:14 ` [Linux-kernel-mentees] " Dwaipayan Ray
@ 2020-12-02 20:00   ` Dwaipayan Ray
  -1 siblings, 0 replies; 6+ messages in thread
From: Dwaipayan Ray @ 2020-12-02 20:00 UTC (permalink / raw)
  To: Joe Perches; +Cc: linux-kernel-mentees, linux-kernel, Lukas Bulwahn, Peilin Ye

On Wed, Dec 2, 2020 at 3:45 PM Dwaipayan Ray <dwaipayanray1@gmail.com> 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.
>
> Add a new check which emits a warning on finding lines starting
> with a '#'. Also add a quick fix by adding a tab in front of
> such lines.
>
> Suggested-by: Peilin Ye <yepeilin.cs@gmail.com>
> Tested-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 e8c1ed0b1fad..a12edcf4f63a 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("POSSIBLE_IGNORED_LINE",
> +                                "Commit log lines starting with a '#' might be dropped by git.\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
>
Hi,
This patch may seem trivial but I wanted to send it to you for review
nevertheless.

Peilin had earlier faced this problem in one of his patches which was
mainlined. There were some '#define' lines in the commit log. Due to
some reason the Maintainer had to reword the commit message, and
ultimately those '#define' lines were lost in the tree that was merged.

I am not sure if it would be exactly helpful for regular committers but for
new contributers it might be nice to avoid such a mistake. Do you think
it deserves inclusion in checkpatch?

Thank you,
Dwaipayan.

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

* Re: [Linux-kernel-mentees] [PATCH] checkpatch: add warning for lines starting with a '#' in commit log
@ 2020-12-02 20:00   ` Dwaipayan Ray
  0 siblings, 0 replies; 6+ messages in thread
From: Dwaipayan Ray @ 2020-12-02 20:00 UTC (permalink / raw)
  To: Joe Perches; +Cc: linux-kernel-mentees, linux-kernel, Peilin Ye

On Wed, Dec 2, 2020 at 3:45 PM Dwaipayan Ray <dwaipayanray1@gmail.com> 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.
>
> Add a new check which emits a warning on finding lines starting
> with a '#'. Also add a quick fix by adding a tab in front of
> such lines.
>
> Suggested-by: Peilin Ye <yepeilin.cs@gmail.com>
> Tested-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 e8c1ed0b1fad..a12edcf4f63a 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("POSSIBLE_IGNORED_LINE",
> +                                "Commit log lines starting with a '#' might be dropped by git.\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
>
Hi,
This patch may seem trivial but I wanted to send it to you for review
nevertheless.

Peilin had earlier faced this problem in one of his patches which was
mainlined. There were some '#define' lines in the commit log. Due to
some reason the Maintainer had to reword the commit message, and
ultimately those '#define' lines were lost in the tree that was merged.

I am not sure if it would be exactly helpful for regular committers but for
new contributers it might be nice to avoid such a mistake. Do you think
it deserves inclusion in checkpatch?

Thank you,
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] 6+ messages in thread

* Re: [PATCH] checkpatch: add warning for lines starting with a '#' in commit log
  2020-12-02 20:00   ` [Linux-kernel-mentees] " Dwaipayan Ray
@ 2020-12-02 20:10     ` Joe Perches
  -1 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2020-12-02 20:10 UTC (permalink / raw)
  To: Dwaipayan Ray
  Cc: linux-kernel-mentees, linux-kernel, Lukas Bulwahn, Peilin Ye

On Thu, 2020-12-03 at 01:30 +0530, Dwaipayan Ray wrote:
> On Wed, Dec 2, 2020 at 3:45 PM Dwaipayan Ray <dwaipayanray1@gmail.com> 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.
> > 
> > Add a new check which emits a warning on finding lines starting
> > with a '#'. Also add a quick fix by adding a tab in front of
> > such lines.
> > 
> > Suggested-by: Peilin Ye <yepeilin.cs@gmail.com>
> > Tested-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 e8c1ed0b1fad..a12edcf4f63a 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("POSSIBLE_IGNORED_LINE",
> > +                                "Commit log lines starting with a '#' might be dropped by git.\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
> > 
> Hi,
> This patch may seem trivial but I wanted to send it to you for review
> nevertheless.
> 
> Peilin had earlier faced this problem in one of his patches which was
> mainlined. There were some '#define' lines in the commit log. Due to
> some reason the Maintainer had to reword the commit message, and
> ultimately those '#define' lines were lost in the tree that was merged.
> 
> I am not sure if it would be exactly helpful for regular committers but for
> new contributers it might be nice to avoid such a mistake. Do you think
> it deserves inclusion in checkpatch?

Even regular committers face this.

Please fix the && $fix so that the && is at EOL and change the
'might be dropped' to 'will be dropped by git as a comment' and
remove the period.

"POSSIBLE_IGNORED_LINE" could be something like "COMMIT_COMMENT_SYMBOL".



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

* Re: [Linux-kernel-mentees] [PATCH] checkpatch: add warning for lines starting with a '#' in commit log
@ 2020-12-02 20:10     ` Joe Perches
  0 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2020-12-02 20:10 UTC (permalink / raw)
  To: Dwaipayan Ray; +Cc: linux-kernel-mentees, linux-kernel, Peilin Ye

On Thu, 2020-12-03 at 01:30 +0530, Dwaipayan Ray wrote:
> On Wed, Dec 2, 2020 at 3:45 PM Dwaipayan Ray <dwaipayanray1@gmail.com> 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.
> > 
> > Add a new check which emits a warning on finding lines starting
> > with a '#'. Also add a quick fix by adding a tab in front of
> > such lines.
> > 
> > Suggested-by: Peilin Ye <yepeilin.cs@gmail.com>
> > Tested-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 e8c1ed0b1fad..a12edcf4f63a 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("POSSIBLE_IGNORED_LINE",
> > +                                "Commit log lines starting with a '#' might be dropped by git.\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
> > 
> Hi,
> This patch may seem trivial but I wanted to send it to you for review
> nevertheless.
> 
> Peilin had earlier faced this problem in one of his patches which was
> mainlined. There were some '#define' lines in the commit log. Due to
> some reason the Maintainer had to reword the commit message, and
> ultimately those '#define' lines were lost in the tree that was merged.
> 
> I am not sure if it would be exactly helpful for regular committers but for
> new contributers it might be nice to avoid such a mistake. Do you think
> it deserves inclusion in checkpatch?

Even regular committers face this.

Please fix the && $fix so that the && is at EOL and change the
'might be dropped' to 'will be dropped by git as a comment' and
remove the period.

"POSSIBLE_IGNORED_LINE" could be something like "COMMIT_COMMENT_SYMBOL".


_______________________________________________
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] 6+ messages in thread

end of thread, other threads:[~2020-12-02 20:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-02 10:14 [PATCH] checkpatch: add warning for lines starting with a '#' in commit log Dwaipayan Ray
2020-12-02 10:14 ` [Linux-kernel-mentees] " Dwaipayan Ray
2020-12-02 20:00 ` Dwaipayan Ray
2020-12-02 20:00   ` [Linux-kernel-mentees] " Dwaipayan Ray
2020-12-02 20:10   ` Joe Perches
2020-12-02 20:10     ` [Linux-kernel-mentees] " Joe Perches

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.