[{"id":26484,"web_url":"https://patchwork.libcamera.org/comment/26484/","msgid":"<Y/zBno4/4iGCLjRU@pendragon.ideasonboard.com>","date":"2023-02-27T14:43:42","subject":"Re: [libcamera-devel] [PATCH] utils: checkstyle.py: Don't run\n\tcommit title checker on staged commits","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Paul,\n\nThank you for the patch.\n\nOn Mon, Feb 27, 2023 at 09:15:46PM +0900, Paul Elder via libcamera-devel wrote:\n> When creating a new commit, there is no title, so the title checker\n> complains that the title isn't compliant and the commit cannot be\n> created if checkstyle is run as a pre-commit hook. Fix this by skipping\n> the title checker when run on staged changes.\n> \n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> ---\n>  utils/checkstyle.py | 3 +++\n>  1 file changed, 3 insertions(+)\n> \n> diff --git a/utils/checkstyle.py b/utils/checkstyle.py\n> index 78645410..84f0f50f 100755\n> --- a/utils/checkstyle.py\n> +++ b/utils/checkstyle.py\n> @@ -360,6 +360,9 @@ class TitleChecker(CommitChecker):\n>      def check(cls, commit, top_level):\n>          title = commit.title\n>  \n> +        if title == 'Staged changes':\n> +            return []\n> +\n\nThe idea is good, but checking the title seems a bit of a hack. You can\ninstead check if the commit is an instance of the StagedChanges class.\n\n>          # Ignore release commits, they don't need a prefix.\n>          if TitleChecker.release_regex.fullmatch(title):\n>              return []","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id D1281BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 27 Feb 2023 14:43:46 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0C1EB6265A;\n\tMon, 27 Feb 2023 15:43:46 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3877462636\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Feb 2023 15:43:44 +0100 (CET)","from pendragon.ideasonboard.com (85-76-78-34-nat.elisa-mobile.fi\n\t[85.76.78.34])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1BB0F56A;\n\tMon, 27 Feb 2023 15:43:42 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1677509026;\n\tbh=VxefoyocBsUjB05UvfoW6fOxjsFx+M582vX3QgC7OaI=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=O/4HzbRAX4vWr2o7VeDYIaLZLbd0ZBT7gDdp5L6PlwopymceW58nJLrU9iclqz2Wh\n\tL+vvKqKNPW3u8Dpd/EkMU92OvjHcHYiTtRO24cQbdpzOvSOzM2YzZgnUNmb/8GoVpf\n\tnPut76vf4l2GrrXga5lpijBgf25eMH0EpShJj95/8ADCFqrMu59Trg9I9GbeJMBKJ7\n\tU12TCun2Lcjt3CKw+zmpP9aAhFUTnt3dyT+ipdqBR7WDNgC/AaVM0M0M1xaAmdigTV\n\tAKcO3cmDb1HcMGj+xazBLiiqUevUbP7sNiUSzR5g1lnyz7sYmozwEWovAKzUlFRGls\n\t43xAdusNC0E2w==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1677509023;\n\tbh=VxefoyocBsUjB05UvfoW6fOxjsFx+M582vX3QgC7OaI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=aWD7ao6O7g7xEo7wxAfh0D+OV4D7vPfEuiowInJ2zeWHMgajFBXrwKZfi/heG9VIx\n\t/BE3qVkghTCy4UoDeaUTaraSBq0LWhWpzz8Ho4JSOiUJqtWbhssfjXj7/iSCvH0Rpc\n\tgWUpMKxu6Yp33RXV2gnx/ndvCriNZkrGd4dxr6KY="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"aWD7ao6O\"; dkim-atps=neutral","Date":"Mon, 27 Feb 2023 16:43:42 +0200","To":"Paul Elder <paul.elder@ideasonboard.com>","Message-ID":"<Y/zBno4/4iGCLjRU@pendragon.ideasonboard.com>","References":"<20230227121546.3231835-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20230227121546.3231835-1-paul.elder@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH] utils: checkstyle.py: Don't run\n\tcommit title checker on staged commits","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]