[2/2] utils: checkstyle.py: Validate SoB trailer against author
diff mbox series

Message ID 20240805174807.10125-2-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • [1/2] utils: checkstyle.py: Add author property to Commit class
Related show

Commit Message

Laurent Pinchart Aug. 5, 2024, 5:48 p.m. UTC
The TrailersChecker enforces the presence of a Signed-off-by tag in the
trailer, but doesn't verify that the tag matches the commit's author.
Add that verification, as required by the libcamera contribution
process.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 utils/checkstyle.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Stefan Klug Aug. 6, 2024, 7:11 a.m. UTC | #1
Hi Laurent,

Thank you for the patch. 

On Mon, Aug 05, 2024 at 08:48:07PM +0300, Laurent Pinchart wrote:
> The TrailersChecker enforces the presence of a Signed-off-by tag in the
> trailer, but doesn't verify that the tag matches the commit's author.
> Add that verification, as required by the libcamera contribution
> process.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  utils/checkstyle.py | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/utils/checkstyle.py b/utils/checkstyle.py
> index 1eeb3809f7fe..722b59920062 100755
> --- a/utils/checkstyle.py
> +++ b/utils/checkstyle.py
> @@ -524,10 +524,11 @@ class TrailersChecker(CommitChecker):
>                  continue
>  
>              if key == 'Signed-off-by':
> -                sob_found = True
> +                if value == commit.author:
> +                    sob_found = True
>  
>          if not sob_found:
> -            issues.append(CommitIssue(f"No valid 'Signed-off-by' trailer found, see Documentation/contributing.rst"))
> +            issues.append(CommitIssue(f"No 'Signed-off-by' trailer matching author '{commit.author}', see Documentation/contributing.rst"))

I like long lines :-)

Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> 

>  
>          return issues
>  
> -- 
> Regards,
> 
> Laurent Pinchart
>
Laurent Pinchart Aug. 6, 2024, 7:42 a.m. UTC | #2
On Tue, Aug 06, 2024 at 09:11:37AM +0200, Stefan Klug wrote:
> Hi Laurent,
> 
> Thank you for the patch. 
> 
> On Mon, Aug 05, 2024 at 08:48:07PM +0300, Laurent Pinchart wrote:
> > The TrailersChecker enforces the presence of a Signed-off-by tag in the
> > trailer, but doesn't verify that the tag matches the commit's author.
> > Add that verification, as required by the libcamera contribution
> > process.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> >  utils/checkstyle.py | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/utils/checkstyle.py b/utils/checkstyle.py
> > index 1eeb3809f7fe..722b59920062 100755
> > --- a/utils/checkstyle.py
> > +++ b/utils/checkstyle.py
> > @@ -524,10 +524,11 @@ class TrailersChecker(CommitChecker):
> >                  continue
> >  
> >              if key == 'Signed-off-by':
> > -                sob_found = True
> > +                if value == commit.author:
> > +                    sob_found = True
> >  
> >          if not sob_found:
> > -            issues.append(CommitIssue(f"No valid 'Signed-off-by' trailer found, see Documentation/contributing.rst"))
> > +            issues.append(CommitIssue(f"No 'Signed-off-by' trailer matching author '{commit.author}', see Documentation/contributing.rst"))
> 
> I like long lines :-)

I don't, but I also disliked cutting single line strings in the middle
in code :-)

> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> 
> 
> >  
> >          return issues
> >
Kieran Bingham Aug. 6, 2024, 9:06 a.m. UTC | #3
Quoting Laurent Pinchart (2024-08-05 18:48:07)
> The TrailersChecker enforces the presence of a Signed-off-by tag in the
> trailer, but doesn't verify that the tag matches the commit's author.
> Add that verification, as required by the libcamera contribution
> process.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  utils/checkstyle.py | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/utils/checkstyle.py b/utils/checkstyle.py
> index 1eeb3809f7fe..722b59920062 100755
> --- a/utils/checkstyle.py
> +++ b/utils/checkstyle.py
> @@ -524,10 +524,11 @@ class TrailersChecker(CommitChecker):
>                  continue
>  
>              if key == 'Signed-off-by':
> -                sob_found = True
> +                if value == commit.author:
> +                    sob_found = True
>  
>          if not sob_found:
> -            issues.append(CommitIssue(f"No valid 'Signed-off-by' trailer found, see Documentation/contributing.rst"))
> +            issues.append(CommitIssue(f"No 'Signed-off-by' trailer matching author '{commit.author}', see Documentation/contributing.rst"))
>  

That's what I was expecting ;-)


Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

>          return issues
>  
> -- 
> Regards,
> 
> Laurent Pinchart
>

Patch
diff mbox series

diff --git a/utils/checkstyle.py b/utils/checkstyle.py
index 1eeb3809f7fe..722b59920062 100755
--- a/utils/checkstyle.py
+++ b/utils/checkstyle.py
@@ -524,10 +524,11 @@  class TrailersChecker(CommitChecker):
                 continue
 
             if key == 'Signed-off-by':
-                sob_found = True
+                if value == commit.author:
+                    sob_found = True
 
         if not sob_found:
-            issues.append(CommitIssue(f"No valid 'Signed-off-by' trailer found, see Documentation/contributing.rst"))
+            issues.append(CommitIssue(f"No 'Signed-off-by' trailer matching author '{commit.author}', see Documentation/contributing.rst"))
 
         return issues