2021-01-28 16:08:14

by Shradha Todi

[permalink] [raw]
Subject: [PATCH] checkpatch: add warning for line space after "Fixes:" tag

Add a check to give warning for line break between Fixes tag
and signature tags as that is the commonly followed style.

Also add a --fix option to delete space lines after "Fixes:" tag.

Signed-off-by: Lakshay Mehra <[email protected]>
Signed-off-by: Shradha Todi <[email protected]>
---
scripts/checkpatch.pl | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 92e888e..6c144c5 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3027,6 +3027,15 @@ sub process {
$commit_log_long_line = 1;
}

+# Check for no line break after Fixes
+ if ($line =~ /^\s*Fixes:/i && $rawlines[$linenr] =~ /^\s*$/) {
+ if (WARN("UNNECESSARY_NEWLINE",
+ "Newline is not required after Fixes:\n" . $herecurr) &&
+ $fix) {
+ fix_delete_line($fixlinenr+1, $rawline);
+ }
+ }
+
# Reset possible stack dump if a blank line is found
if ($in_commit_log && $commit_log_possible_stack_dump &&
$line =~ /^\s*$/) {
--
2.7.4


2021-02-01 11:26:56

by Shradha Todi

[permalink] [raw]
Subject: RE: [PATCH] checkpatch: add warning for line space after "Fixes:" tag

> -----Original Message-----
> From: Joe Perches <[email protected]>
> Subject: Re: [PATCH] checkpatch: add warning for line space after
"Fixes:" tag
>
> On Thu, 2021-01-28 at 20:56 +0530, Shradha Todi wrote:
> > Add a check to give warning for line break between Fixes tag
> > and signature tags as that is the commonly followed style.
> >
> > Also add a --fix option to delete space lines after "Fixes:" tag.
> >
> > Signed-off-by: Lakshay Mehra <[email protected]>
> > Signed-off-by: Shradha Todi <[email protected]>
> > ---
> > ?scripts/checkpatch.pl | 9 +++++++++
> > ?1 file changed, 9 insertions(+)
> >
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > index 92e888e..6c144c5 100755
> > --- a/scripts/checkpatch.pl
> > +++ b/scripts/checkpatch.pl
> > @@ -3027,6 +3027,15 @@ sub process {
> > ? $commit_log_long_line = 1;
> > ? }
> >
> >
> > +# Check for no line break after Fixes
> > + if ($line =~ /^\s*Fixes:/i && $rawlines[$linenr] =~
/^\s*$/) {
> > + if (WARN("UNNECESSARY_NEWLINE",
> > + "Newline is not required after Fixes:\n" .
> $herecurr) &&
> > + $fix) {
> > + fix_delete_line($fixlinenr+1, $rawline);
> > + }
> > + }
>
> I think this isn't necessary and $rawlines[$linenr] may be not exist.
>

I recently submitted a patch with the fixes tag followed by a line break
and then SOB.
I received a comment saying "no line space between Fixes and SOB" [1].
So my intention of adding this was to save the maintainers time from these
silly mistakes.
Any suggestions for improving this patch? Thanks a ton for the prompt
review.
[1]: https://lkml.org/lkml/2021/1/6/291



2021-02-01 16:34:32

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH] checkpatch: add warning for line space after "Fixes:" tag

On Mon, 1 Feb 2021 at 12:27, Shradha Todi <[email protected]> wrote:
>
> > -----Original Message-----
> > From: Joe Perches <[email protected]>
> > Subject: Re: [PATCH] checkpatch: add warning for line space after
> "Fixes:" tag
> >
> > On Thu, 2021-01-28 at 20:56 +0530, Shradha Todi wrote:
> > > Add a check to give warning for line break between Fixes tag
> > > and signature tags as that is the commonly followed style.
> > >
> > > Also add a --fix option to delete space lines after "Fixes:" tag.
> > >
> > > Signed-off-by: Lakshay Mehra <[email protected]>
> > > Signed-off-by: Shradha Todi <[email protected]>
> > > ---
> > > scripts/checkpatch.pl | 9 +++++++++
> > > 1 file changed, 9 insertions(+)
> > >
> > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > > index 92e888e..6c144c5 100755
> > > --- a/scripts/checkpatch.pl
> > > +++ b/scripts/checkpatch.pl
> > > @@ -3027,6 +3027,15 @@ sub process {
> > > $commit_log_long_line = 1;
> > > }
> > >
> > >
> > > +# Check for no line break after Fixes
> > > + if ($line =~ /^\s*Fixes:/i && $rawlines[$linenr] =~
> /^\s*$/) {
> > > + if (WARN("UNNECESSARY_NEWLINE",
> > > + "Newline is not required after Fixes:\n" .
> > $herecurr) &&
> > > + $fix) {
> > > + fix_delete_line($fixlinenr+1, $rawline);
> > > + }
> > > + }
> >
> > I think this isn't necessary and $rawlines[$linenr] may be not exist.
> >
>
> I recently submitted a patch with the fixes tag followed by a line break
> and then SOB.
> I received a comment saying "no line space between Fixes and SOB" [1].
> So my intention of adding this was to save the maintainers time from these
> silly mistakes.
> Any suggestions for improving this patch? Thanks a ton for the prompt
> review.

Hi,

Thanks for your submission. Suggestion is: do not ping too early, give
around 2 weeks for review. If nothing happens after two weeks, resend
or ping.

Best regards,
Krzysztof