[libcamera-devel] [PATCH v2] utils: checkstyle.py: Don't run commit title checker on staged commits
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Tue Feb 28 14:35:47 CET 2023
Hi Paul,
Thank you for the patch.
On Tue, Feb 28, 2023 at 03:18:59PM +0900, Paul Elder via libcamera-devel wrote:
> When creating a new commit, there is no title, so the title checker
> complains that the title isn't compliant and the commit cannot be
> created if checkstyle is run as a pre-commit hook. Fix this by skipping
> the title checker when run on staged changes.
>
> Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
> ---
> utils/checkstyle.py | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/utils/checkstyle.py b/utils/checkstyle.py
> index 78645410..eb62e4ab 100755
> --- a/utils/checkstyle.py
> +++ b/utils/checkstyle.py
> @@ -360,6 +360,9 @@ class TitleChecker(CommitChecker):
> def check(cls, commit, top_level):
> title = commit.title
>
A comment here would be nice.
# Skip the check when validating staged changes (as done through a
# pre-commit hook) as there is no title to check in that case.
With that,
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> + if isinstance(commit, StagedChanges):
> + return []
> +
> # Ignore release commits, they don't need a prefix.
> if TitleChecker.release_regex.fullmatch(title):
> return []
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list