[libcamera-devel] [PATCH] utils: checkstyle.py: Don't run commit title checker on staged commits
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Mon Feb 27 15:43:42 CET 2023
Hi Paul,
Thank you for the patch.
On Mon, Feb 27, 2023 at 09:15:46PM +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..84f0f50f 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
>
> + if title == 'Staged changes':
> + return []
> +
The idea is good, but checking the title seems a bit of a hack. You can
instead check if the commit is an instance of the StagedChanges class.
> # 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