[{"id":27482,"web_url":"https://patchwork.libcamera.org/comment/27482/","msgid":"<168851600935.3885022.1208257676024164469@Monstersaurus>","date":"2023-07-05T00:13:29","subject":"Re: [libcamera-devel] [PATCH v1 3/4] utils: checkstyle: Don't\n\tinclude commit ID in commit title","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Laurent Pinchart via libcamera-devel (2023-06-12 23:47:50)\n> The commit title and commit ID are two different pieces of information.\n> Don't include the latter in the former, to simplify code that only needs\n> the commit title. Constructing a string from the ID and title is easier\n> than splitting the combined string back into its elements.\n\nSeems to make sense.\n\nI can see why you wanted to run a single checker to work through this.\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  utils/checkstyle.py | 17 +++++++++--------\n>  1 file changed, 9 insertions(+), 8 deletions(-)\n> \n> diff --git a/utils/checkstyle.py b/utils/checkstyle.py\n> index 3104acfa2065..e68c874609bc 100755\n> --- a/utils/checkstyle.py\n> +++ b/utils/checkstyle.py\n> @@ -210,12 +210,12 @@ class Commit:\n>  \n>      def _parse(self):\n>          # Get the commit title and list of files.\n> -        ret = subprocess.run(['git', 'show', '--pretty=oneline', '--name-status',\n> +        ret = subprocess.run(['git', 'show', '--format=%s', '--name-status',\n>                                self.commit],\n>                               stdout=subprocess.PIPE).stdout.decode('utf-8')\n> -        files = ret.splitlines()\n> -        self._files = [CommitFile(f) for f in files[1:]]\n> -        self._title = files[0]\n> +        lines = ret.splitlines()\n> +        self._files = [CommitFile(f) for f in lines[1:] if f]\n> +        self._title = lines[0]\n>  \n>      def files(self, filter='AMR'):\n>          return [f.filename for f in self._files if f.status in filter]\n> @@ -358,7 +358,7 @@ class HeaderAddChecker(CommitChecker):\n>  \n>  \n>  class TitleChecker(CommitChecker):\n> -    prefix_regex = re.compile(r'[0-9a-f]+ (([a-zA-Z0-9_.-]+: )+)')\n> +    prefix_regex = re.compile(r'^([a-zA-Z0-9_.-]+: )+')\n>      release_regex = re.compile(r'libcamera v[0-9]+\\.[0-9]+\\.[0-9]+')\n>  \n>      @classmethod\n> @@ -388,7 +388,7 @@ class TitleChecker(CommitChecker):\n>              if not prefix:\n>                  continue\n>  \n> -            prefix = prefix.group(1)\n> +            prefix = prefix.group(0)\n>              if prefix in prefixes:\n>                  prefixes[prefix] += 1\n>              else:\n> @@ -846,9 +846,10 @@ def check_file(top_level, commit, filename, checkers):\n>  \n>  \n>  def check_style(top_level, commit, checkers):\n> -    separator = '-' * len(commit.title)\n> +    title = commit.commit + ' ' + commit.title\n> +    separator = '-' * len(title)\n>      print(separator)\n> -    print(commit.title)\n> +    print(title)\n>      print(separator)\n>  \n>      issues = 0\n> -- \n> Regards,\n> \n> Laurent Pinchart\n>","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 8AEB6BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  5 Jul 2023 00:13:34 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D730F628C1;\n\tWed,  5 Jul 2023 02:13:33 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1CFA261E38\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  5 Jul 2023 02:13:32 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net\n\t[82.37.23.78])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 83D7CDC9;\n\tWed,  5 Jul 2023 02:12:47 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1688516013;\n\tbh=erQXyBzhZCAHwGBKmv3C2FGbfRspR1JifbtKxRMu3rQ=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=TyJ7Mzv+Fm9ze8vgnFqlGI7LmMDSdXxEdDrZPCXa6yyEuKxKIs9wLSlHk3SbESJMJ\n\tJH5SB5qxHH+LEbHmpGUe7oTMdDu9dxseyg04LhXPedeJqLPvbWWc3ds/g/8WWjpJ+7\n\tRqleV/hS/f9mlCDd+u8q5pWiiLxnmxH7LRiqSethc3sQres0I0T4MOjH5UUEOikVji\n\tnCvGs1hHXtiCBfbwWqOps3t2Mu7MZiuXuBel/bUcBcxjARBjOyWhPewJZLrDTWspqz\n\tOygf9Lt4GLsIxl2SGRJ3L7i47D6CY8JoBDWd+hhd8qcT6V4JFReUzdiVXxDSsVgrhC\n\tZtzUEZ9EVDn1Q==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1688515967;\n\tbh=erQXyBzhZCAHwGBKmv3C2FGbfRspR1JifbtKxRMu3rQ=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=GT4ggnwzzq2BRRmzDU3gwAZ/iLlwnnjxE66Oyv4vqkadspzjNx/WderLYJj75u5iv\n\t9v2xU5rijqWWjQFKxwlQHl+ATxv3yXio3o7axiq0/tdudytcVys1K6HZ6Xx/IEeQzH\n\t6KyPM/Um9luPqzKFPbw7NiIDfei3xEe3ruz44bW0="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"GT4ggnwz\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20230612224751.4437-4-laurent.pinchart@ideasonboard.com>","References":"<20230612224751.4437-1-laurent.pinchart@ideasonboard.com>\n\t<20230612224751.4437-4-laurent.pinchart@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Wed, 05 Jul 2023 01:13:29 +0100","Message-ID":"<168851600935.3885022.1208257676024164469@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v1 3/4] utils: checkstyle: Don't\n\tinclude commit ID in commit title","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":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]