[libcamera-devel,1/4] utils: checkstyle.py: Treat Malformed trailers as a CommitIssue
diff mbox series

Message ID 20230711133915.650485-2-kieran.bingham@ideasonboard.com
State Accepted
Commit b14d2cab127b05399348cca31eb9190eee0f305f
Headers show
Series
  • utils: checkstyle.py: Fix Trailer handling
Related show

Commit Message

Kieran Bingham July 11, 2023, 1:39 p.m. UTC
If a Malformed trailer is identified the checkstyle script triggers a
RuntimeError and stops processing the rest of the commit.

A malformed trailer can be regarded as an issue in the commit and
reported as such using the same method as other faults identified by the
tool.

Convert the RuntimeError into a CommitIssue and continue processing
other trailers.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 utils/checkstyle.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Umang Jain July 11, 2023, 1:48 p.m. UTC | #1
Hi Kieran,

Thanks for the patch.

On 7/11/23 7:09 PM, Kieran Bingham via libcamera-devel wrote:
> If a Malformed trailer is identified the checkstyle script triggers a
> RuntimeError and stops processing the rest of the commit.
>
> A malformed trailer can be regarded as an issue in the commit and
> reported as such using the same method as other faults identified by the
> tool.
>
> Convert the RuntimeError into a CommitIssue and continue processing
> other trailers.
>
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>

> ---
>   utils/checkstyle.py | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/utils/checkstyle.py b/utils/checkstyle.py
> index 3558740d389d..5a1268064d31 100755
> --- a/utils/checkstyle.py
> +++ b/utils/checkstyle.py
> @@ -479,7 +479,8 @@ class TrailersChecker(CommitChecker):
>           for trailer in commit.trailers:
>               match = TrailersChecker.trailer_regex.fullmatch(trailer)
>               if not match:
> -                raise RuntimeError(f"Malformed commit trailer '{trailer}'")
> +                issues.append(CommitIssue(f"Malformed commit trailer '{trailer}'"))
> +                continue
>   
>               key, value = match.groups()
>

Patch
diff mbox series

diff --git a/utils/checkstyle.py b/utils/checkstyle.py
index 3558740d389d..5a1268064d31 100755
--- a/utils/checkstyle.py
+++ b/utils/checkstyle.py
@@ -479,7 +479,8 @@  class TrailersChecker(CommitChecker):
         for trailer in commit.trailers:
             match = TrailersChecker.trailer_regex.fullmatch(trailer)
             if not match:
-                raise RuntimeError(f"Malformed commit trailer '{trailer}'")
+                issues.append(CommitIssue(f"Malformed commit trailer '{trailer}'"))
+                continue
 
             key, value = match.groups()