[{"id":23185,"web_url":"https://patchwork.libcamera.org/comment/23185/","msgid":"<1bc58a8b-4af8-da4d-2880-72ca25c7263a@ideasonboard.com>","date":"2022-05-27T09:47:31","subject":"Re: [libcamera-devel] [PATCH 2/3] utils: checkstyle: Ensure \"...\"\n\tinclude style for internal headers","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Laurent,\n\nThank you for the patch.\n\nOn 5/26/22 13:00, Laurent Pinchart via libcamera-devel wrote:\n> libcamera uses the \"...\" include style for internal headers. Enforce it.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n\n> ---\n>   utils/checkstyle.py | 18 ++++++++++++++++--\n>   1 file changed, 16 insertions(+), 2 deletions(-)\n>\n> diff --git a/utils/checkstyle.py b/utils/checkstyle.py\n> index 66af96abd402..61783165bef2 100755\n> --- a/utils/checkstyle.py\n> +++ b/utils/checkstyle.py\n> @@ -643,7 +643,7 @@ class DPointerFormatter(Formatter):\n>   class IncludeOrderFormatter(Formatter):\n>       patterns = ('*.cpp', '*.h')\n>   \n> -    include_regex = re.compile('^#include [\"<]([^\">]*)[\">]')\n> +    include_regex = re.compile('^#include ([\"<])([^\">]*)([\">])')\n>   \n>       @classmethod\n>       def format(cls, filename, data):\n> @@ -657,7 +657,21 @@ class IncludeOrderFormatter(Formatter):\n>               if match:\n>                   # If the current line is an #include statement, add it to the\n>                   # includes group and continue to the next line.\n> -                includes.append((line, match.group(1)))\n> +                open_token = match.group(1)\n> +                file_name = match.group(2)\n> +                close_token = match.group(3)\n> +\n> +                # Ensure the \"...\" include style for internal headers and the\n> +                # <...> style for all other libcamera headers.\n> +                if (file_name.startswith('libcamera/internal')):\n> +                    open_token = '\"'\n> +                    close_token = '\"'\n> +                elif (file_name.startswith('libcamera/')):\n> +                    open_token = '<'\n> +                    close_token = '>'\n> +\n> +                line = f'#include {open_token}{file_name}{close_token}'\n> +                includes.append((line, file_name))\n>                   continue\n>   \n>               # The current line is not an #include statement, output the sorted","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 1A56DBD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 27 May 2022 09:47:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 556B8633A1;\n\tFri, 27 May 2022 11:47:35 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6195660415\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 May 2022 11:47:34 +0200 (CEST)","from [192.168.1.101] (unknown [90.164.63.43])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CE12731A;\n\tFri, 27 May 2022 11:47:33 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1653644855;\n\tbh=BwuCQkFYiqGoONHhpr6wApPljEhUgS2im+JVjN2bCO8=;\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:\n\tFrom;\n\tb=h9TAhcG1GzDpBvo+KTDWSdaqVsbmJYZ83NFTd3WXeXyKTQ2056L1g1SmrBm9KkPuu\n\t5cU92uRvhfajwoKdNCv574uI39I/0ryLkdV1IsuDnpSqLsiQw8Ka4EZ5iTmN9Nku+U\n\t7gWVzkJOY4x1EY4HbVsAetXGOqDE78MlyOOGQCcdI+eOIm55G7IDlfMVwd2uEAba49\n\t4twi/fyQzk+T0j7W0y9G4w63izF9KyB0h731eATv4NOJNua2Ql5eF9SsGWs6lf2QlX\n\tNwsjOeEjdxVhR+e8G9+OpHt9Kn0uAh4YV1gdMrl05VBvgmxwQ/sxErYAwUDKIjXZGj\n\tG8QjmTFPjNG9A==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1653644854;\n\tbh=BwuCQkFYiqGoONHhpr6wApPljEhUgS2im+JVjN2bCO8=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=ZVlc6BcCqR0t5GctZMeN0tWsHH0W1RSw/YRftqX89sCFsy2CjqnEYQnI78TCzJjn3\n\tNeYCuZi5/uI3HbUp/Zc8hx7/vH8sCWXDflHdKB4N77EHspayjLK0EtiAh4aGJP+aDP\n\tPx+/U3XR5HDvj7i3667oCXnFi+TctOGE3KWs9mRQ="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"ZVlc6BcC\"; dkim-atps=neutral","Message-ID":"<1bc58a8b-4af8-da4d-2880-72ca25c7263a@ideasonboard.com>","Date":"Fri, 27 May 2022 11:47:31 +0200","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.4.1","Content-Language":"en-US","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20220526110009.13874-1-laurent.pinchart@ideasonboard.com>\n\t<20220526110009.13874-3-laurent.pinchart@ideasonboard.com>","In-Reply-To":"<20220526110009.13874-3-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH 2/3] utils: checkstyle: Ensure \"...\"\n\tinclude style for internal headers","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":"Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Umang Jain <umang.jain@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":23262,"web_url":"https://patchwork.libcamera.org/comment/23262/","msgid":"<20220531054007.GI2630765@pyrite.rasen.tech>","date":"2022-05-31T05:40:07","subject":"Re: [libcamera-devel] [PATCH 2/3] utils: checkstyle: Ensure \"...\"\n\tinclude style for internal headers","submitter":{"id":97,"url":"https://patchwork.libcamera.org/api/people/97/","name":"Nicolas Dufresne via libcamera-devel","email":"libcamera-devel@lists.libcamera.org"},"content":"Hi Laurent,\n\nOn Thu, May 26, 2022 at 02:00:08PM +0300, Laurent Pinchart via libcamera-devel wrote:\n> libcamera uses the \"...\" include style for internal headers. Enforce it.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  utils/checkstyle.py | 18 ++++++++++++++++--\n>  1 file changed, 16 insertions(+), 2 deletions(-)\n> \n> diff --git a/utils/checkstyle.py b/utils/checkstyle.py\n> index 66af96abd402..61783165bef2 100755\n> --- a/utils/checkstyle.py\n> +++ b/utils/checkstyle.py\n> @@ -643,7 +643,7 @@ class DPointerFormatter(Formatter):\n>  class IncludeOrderFormatter(Formatter):\n>      patterns = ('*.cpp', '*.h')\n>  \n> -    include_regex = re.compile('^#include [\"<]([^\">]*)[\">]')\n> +    include_regex = re.compile('^#include ([\"<])([^\">]*)([\">])')\n>  \n>      @classmethod\n>      def format(cls, filename, data):\n> @@ -657,7 +657,21 @@ class IncludeOrderFormatter(Formatter):\n>              if match:\n>                  # If the current line is an #include statement, add it to the\n>                  # includes group and continue to the next line.\n> -                includes.append((line, match.group(1)))\n> +                open_token = match.group(1)\n> +                file_name = match.group(2)\n> +                close_token = match.group(3)\n> +\n> +                # Ensure the \"...\" include style for internal headers and the\n> +                # <...> style for all other libcamera headers.\n> +                if (file_name.startswith('libcamera/internal')):\n> +                    open_token = '\"'\n> +                    close_token = '\"'\n> +                elif (file_name.startswith('libcamera/')):\n> +                    open_token = '<'\n> +                    close_token = '>'\n> +\n> +                line = f'#include {open_token}{file_name}{close_token}'\n> +                includes.append((line, file_name))\n>                  continue\n>  \n>              # The current line is not an #include statement, output the sorted","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 8F9C8BD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 31 May 2022 05:40:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D0A3565633;\n\tTue, 31 May 2022 07:40:17 +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 5EFCD6040A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 31 May 2022 07:40:16 +0200 (CEST)","from pyrite.rasen.tech (softbank036240126034.bbtec.net\n\t[36.240.126.34])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B94E96F0;\n\tTue, 31 May 2022 07:40:14 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1653975617;\n\tbh=v77bvWziTNGKlwXIPV7+sOPi1ryBLSI7nwSNJW4448c=;\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=GRhdF9m0NKwME2xC+7hBNfRQ1y3oEGSlQeyG5WTdD4oChWbGyXmceLtSAzkKyQoHW\n\tjMvWS1fKOXGWnFOA4FSllMsXTWqk+2yhnOxwkMkT6fmRuQ98LKC6QrzHo8FbTG0kqG\n\tl4ISzE+jL0dNcrgXxg6+BsfGQk39so4A3Wn0CQDGC0t7T7Rg0oD+/T2XC1HZqJcFS1\n\tMdPY3DbXTXb/4v+YqJkDV96gLXBNUsSeEu1Mav1g8rFec056+xeDWcD4G7oyE8AMlP\n\t+35nO04Sx2bMp1xxGXyE2dcYCt6VrzBALJ6f+1y457E/vjFTGLDw6wNcNxiAzQWlCY\n\t/Vr5LxxfWcO4Q==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1653975616;\n\tbh=v77bvWziTNGKlwXIPV7+sOPi1ryBLSI7nwSNJW4448c=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Tf4nlNUv6ZCRyDaFavl4zs2hofr6BIJ64Y2z4rk7i4tyXvHP4792B8+3Yn+lCGguw\n\tNNfW83Zfvb7jUFVrICpojDcqlWxAO70oH9XItnxcNp7d1Lq1qbcVDqr3/y6jOxm71d\n\twpjEpCE6s+g5GwlqDPZMEbFF9cGwdIvBd8iWR+sE="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Tf4nlNUv\"; dkim-atps=neutral","Date":"Tue, 31 May 2022 14:40:07 +0900","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20220531054007.GI2630765@pyrite.rasen.tech>","References":"<20220526110009.13874-1-laurent.pinchart@ideasonboard.com>\n\t<20220526110009.13874-3-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20220526110009.13874-3-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 2/3] utils: checkstyle: Ensure \"...\"\n\tinclude style for internal headers","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":"Paul Elder via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"paul.elder@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>"}}]