[{"id":27371,"web_url":"https://patchwork.libcamera.org/comment/27371/","msgid":"<871qib8op3.fsf@baylibre.com>","date":"2023-06-16T14:30:16","subject":"Re: [libcamera-devel] [PATCH v1 2/4] utils: checkstyle: Support\n\trunning checkers selectively","submitter":{"id":153,"url":"https://patchwork.libcamera.org/api/people/153/","name":"Mattijs Korpershoek","email":"mkorpershoek@baylibre.com"},"content":"Hi Laurent,\n\nOn mar., juin 13, 2023 at 01:47, Laurent Pinchart via libcamera-devel <libcamera-devel@lists.libcamera.org> wrote:\n\n> During development of the checkstyle.py script, it can be useful to run\n> only a subset of the checker. Add the ability to do so with a\n> '--checkers' command line argument.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  utils/checkstyle.py | 31 +++++++++++++++++++++----------\n>  1 file changed, 21 insertions(+), 10 deletions(-)\n>\n> diff --git a/utils/checkstyle.py b/utils/checkstyle.py\n> index 7da888d8c365..3104acfa2065 100755\n> --- a/utils/checkstyle.py\n> +++ b/utils/checkstyle.py\n> @@ -301,8 +301,10 @@ class CommitChecker(metaclass=ClassRegistry):\n>      # Class methods\n>      #\n>      @classmethod\n> -    def checkers(cls):\n> +    def checkers(cls, names):\n>          for checker in cls.subclasses:\n> +            if names and checker.__name__ not in names:\n> +                continue\n>              yield checker\n>  \n>  \n> @@ -436,8 +438,10 @@ class StyleChecker(metaclass=ClassRegistry):\n>      # Class methods\n>      #\n>      @classmethod\n> -    def checkers(cls, filename):\n> +    def checkers(cls, filename, names):\n>          for checker in cls.subclasses:\n> +            if names and checker.__name__ not in names:\n> +                continue\n>              if checker.supports(filename):\n>                  yield checker\n>  \n> @@ -617,8 +621,10 @@ class Formatter(metaclass=ClassRegistry):\n>      # Class methods\n>      #\n>      @classmethod\n> -    def formatters(cls, filename):\n> +    def formatters(cls, filename, names):\n>          for formatter in cls.subclasses:\n> +            if names and formatter.__name__ not in names:\n> +                continue\n>              if formatter.supports(filename):\n>                  yield formatter\n>  \n> @@ -780,7 +786,7 @@ class StripTrailingSpaceFormatter(Formatter):\n>  # Style checking\n>  #\n>  \n> -def check_file(top_level, commit, filename):\n> +def check_file(top_level, commit, filename, checkers):\n>      # Extract the line numbers touched by the commit.\n>      commit_diff = commit.get_diff(top_level, filename)\n>  \n> @@ -797,7 +803,7 @@ def check_file(top_level, commit, filename):\n>      after = commit.get_file(filename)\n>  \n>      formatted = after\n> -    for formatter in Formatter.formatters(filename):\n> +    for formatter in Formatter.formatters(filename, checkers):\n>          formatted = formatter.format(filename, formatted)\n>  \n>      after = after.splitlines(True)\n> @@ -811,7 +817,7 @@ def check_file(top_level, commit, filename):\n>  \n>      # Check for code issues not related to formatting.\n>      issues = []\n> -    for checker in StyleChecker.checkers(filename):\n> +    for checker in StyleChecker.checkers(filename, checkers):\n>          checker = checker(after)\n>          for hunk in commit_diff:\n>              issues += checker.check(hunk.side('to').touched)\n> @@ -839,7 +845,7 @@ def check_file(top_level, commit, filename):\n>      return len(formatted_diff) + len(issues)\n>  \n>  \n> -def check_style(top_level, commit):\n> +def check_style(top_level, commit, checkers):\n>      separator = '-' * len(commit.title)\n>      print(separator)\n>      print(commit.title)\n> @@ -848,7 +854,7 @@ def check_style(top_level, commit):\n>      issues = 0\n>  \n>      # Apply the commit checkers first.\n> -    for checker in CommitChecker.checkers():\n> +    for checker in CommitChecker.checkers(checkers):\n>          for issue in checker.check(commit, top_level):\n>              print('%s%s%s' % (Colours.fg(Colours.Yellow), issue.msg, Colours.reset()))\n>              issues += 1\n> @@ -860,7 +866,7 @@ def check_style(top_level, commit):\n>      files = [f for f in commit.files() if len([p for p in patterns if fnmatch.fnmatch(os.path.basename(f), p)])]\n>  \n>      for f in files:\n> -        issues += check_file(top_level, commit, f)\n> +        issues += check_file(top_level, commit, f, checkers)\n>  \n>      if issues == 0:\n>          print('No issue detected')\n> @@ -910,6 +916,8 @@ def main(argv):\n>  \n>      # Parse command line arguments\n>      parser = argparse.ArgumentParser()\n> +    parser.add_argument('--checkers', '-c', type=str,\n> +                        help='Specify which checkers to run as a comma-separated list. Defaults to all checkers')\n\nShould we also want to add --list-checkers? it might be more convenient\nthan to have to browse the checkstyle.py code for finding the checker names.\n\n>      parser.add_argument('--staged', '-s', action='store_true',\n>                          help='Include the changes in the index. Defaults to False')\n>      parser.add_argument('--amend', '-a', action='store_true',\n> @@ -918,6 +926,9 @@ def main(argv):\n>                          help='Revision range (as defined by git rev-parse). Defaults to HEAD if not specified.')\n>      args = parser.parse_args(argv[1:])\n>  \n> +    if args.checkers:\n> +        args.checkers = args.checkers.split(',')\n> +\n>      # Check for required dependencies.\n>      for command, mandatory in dependencies.items():\n>          found = shutil.which(command)\n> @@ -951,7 +962,7 @@ def main(argv):\n>  \n>      issues = 0\n>      for commit in commits:\n> -        issues += check_style(top_level, commit)\n> +        issues += check_style(top_level, commit, args.checkers)\n>          print('')\n>  \n\nReviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>\n\n>      if issues:\n> -- \n> Regards,\n>\n> Laurent Pinchart","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 33391C322E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 16 Jun 2023 14:30:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8B04F628B8;\n\tFri, 16 Jun 2023 16:30:18 +0200 (CEST)","from mail-wm1-x334.google.com (mail-wm1-x334.google.com\n\t[IPv6:2a00:1450:4864:20::334])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D1C1D628AE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 16 Jun 2023 16:30:17 +0200 (CEST)","by mail-wm1-x334.google.com with SMTP id\n\t5b1f17b1804b1-3f8d1eb535eso6057435e9.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 16 Jun 2023 07:30:17 -0700 (PDT)","from localhost ([2a01:cb19:85e6:1900:2bf7:7388:731d:c4e1])\n\tby smtp.gmail.com with ESMTPSA id\n\t17-20020a05600c021100b003f735ba7736sm2308656wmi.46.2023.06.16.07.30.16\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 16 Jun 2023 07:30:16 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1686925818;\n\tbh=oVal9jWHTSFyjpcdDBveAx9CODFDjABB/6sKGlkkDMw=;\n\th=To:In-Reply-To:References:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=3I+zzKtOl70M9CUxQFYGvgXYhFD9eWPfopTI8aHqYX7OXc9XUde8RwTv74zhzxGl/\n\tVkxx3K/vESMeD23DIO12Kn+4mEuAbUWGUBWwRXg/s7Yu+E41WkuMEFu6RN7p30hILJ\n\tYcJjmduoBsnciaIjkDuJfHHLOqwmxJJHcNGnJ+ooBPFRUhxQkxXG+OvQECTEa6/8k9\n\thHZIuggXB/TFgamaOK02COZBKuIBRy0krU2SHjOPvdgNp/aVO+Sb/c4NbD/yS0f2Z9\n\tbGSzjcforYE9OwO0DHtGEumQfiLt8o3U6UOCTLdnjqs0PSTMgNRZ+YVz5sUz5FFBK8\n\tjMRZ43s9983gA==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=baylibre-com.20221208.gappssmtp.com; s=20221208; t=1686925817;\n\tx=1689517817; \n\th=mime-version:message-id:date:references:in-reply-to:subject:to:from\n\t:from:to:cc:subject:date:message-id:reply-to;\n\tbh=4ZZPA5lyK7Rv2IXAFcFYYqwbe0GkT1ZbqSdWNAkCqtc=;\n\tb=RwLNLR1QrI68/w4nyzyA8OZtBfSAfj4ygGNZZmjXh4q/iFJKMCfx7uFCQUl/WqjIxF\n\t1MfJNtGCUp3MxCuTFkZTZS9jQBLbT4o9uwZJiZCru7E/XrwNpJ+JrmzDBgtKPufCAZcR\n\tLFtTxHeKqzTUeBJ1fMWE/8+TyhgUZJgIWcEa4R/n8hloal5WIfR4Aky1l08gXdCtnFLb\n\tabuqk84b0GkegIBakVZ+VruoHZQ19RvUaN9PhBL1IaQx2wmibAA0aBhrIB6TOUKInWvp\n\tKBCFg93U5TMjQb+fgWcaQ8G1hhYgkITg45BBxK1STuSGWSJYmgqpggftzYFpMWN4TPU2\n\tYNXA=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=baylibre-com.20221208.gappssmtp.com\n\theader.i=@baylibre-com.20221208.gappssmtp.com header.b=\"RwLNLR1Q\"; \n\tdkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20221208; t=1686925817; x=1689517817;\n\th=mime-version:message-id:date:references:in-reply-to:subject:to:from\n\t:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;\n\tbh=4ZZPA5lyK7Rv2IXAFcFYYqwbe0GkT1ZbqSdWNAkCqtc=;\n\tb=Obse463fcfkwsnffcj9/dP6gYcHbvVdPo2RN0DyufJhfaq9NWVRFOT+9eXUjTooLlg\n\tBXInVyommxzpodN5dYrOZGoXYzUMSL7/sAU3MRC00oCY260ycnifBItF7Hu1h/9ESkht\n\tnZH+4KQrSFE+oRq9eV7BuM9YBeGKfAwhuh+ch0q5aejVDUTOGvAnRd5HUdwCxbdjzica\n\tFKbytAr7JptGxizKzxOEI55AvAVfw009JsbhjMf2M/p7r9qwipfE/bGdhgHPJoGAmLzC\n\tuxIrQJ8mylueZLV9ogR6rmtpgvyxLGMdedJCTpRo71zV8TuHvRqYDUfJ+dUDCNULvmRR\n\tdrVw==","X-Gm-Message-State":"AC+VfDz8PlZYNMdau/CIz8T5GbQ9Em6ZV8eTwbQ7nOOX8xeVWQn0pcKA\n\trx/aIg4GC8nbjJ5i/Sf1+gPYLbXfAfkX+gDCQcE=","X-Google-Smtp-Source":"ACHHUZ7uVGv71OqDk7GXL84J89V6k3xfZ9FxC2RgoDem+pk7TvT9E/g16iFXsk8DNI6b9/Jil22NHQ==","X-Received":"by 2002:a1c:7507:0:b0:3f7:678c:74b0 with SMTP id\n\to7-20020a1c7507000000b003f7678c74b0mr555660wmc.12.1686925817275; \n\tFri, 16 Jun 2023 07:30:17 -0700 (PDT)","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","In-Reply-To":"<20230612224751.4437-3-laurent.pinchart@ideasonboard.com>","References":"<20230612224751.4437-1-laurent.pinchart@ideasonboard.com>\n\t<20230612224751.4437-3-laurent.pinchart@ideasonboard.com>","Date":"Fri, 16 Jun 2023 16:30:16 +0200","Message-ID":"<871qib8op3.fsf@baylibre.com>","MIME-Version":"1.0","Content-Type":"text/plain","Subject":"Re: [libcamera-devel] [PATCH v1 2/4] utils: checkstyle: Support\n\trunning checkers selectively","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":"Mattijs Korpershoek via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Mattijs Korpershoek <mkorpershoek@baylibre.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":27372,"web_url":"https://patchwork.libcamera.org/comment/27372/","msgid":"<20230616145518.GG14547@pendragon.ideasonboard.com>","date":"2023-06-16T14:55:18","subject":"Re: [libcamera-devel] [PATCH v1 2/4] utils: checkstyle: Support\n\trunning checkers selectively","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Mattijs,\n\nOn Fri, Jun 16, 2023 at 04:30:16PM +0200, Mattijs Korpershoek wrote:\n> On mar., juin 13, 2023 at 01:47, Laurent Pinchart via libcamera-devel wrote:\n> \n> > During development of the checkstyle.py script, it can be useful to run\n> > only a subset of the checker. Add the ability to do so with a\n> > '--checkers' command line argument.\n> >\n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > ---\n> >  utils/checkstyle.py | 31 +++++++++++++++++++++----------\n> >  1 file changed, 21 insertions(+), 10 deletions(-)\n> >\n> > diff --git a/utils/checkstyle.py b/utils/checkstyle.py\n> > index 7da888d8c365..3104acfa2065 100755\n> > --- a/utils/checkstyle.py\n> > +++ b/utils/checkstyle.py\n> > @@ -301,8 +301,10 @@ class CommitChecker(metaclass=ClassRegistry):\n> >      # Class methods\n> >      #\n> >      @classmethod\n> > -    def checkers(cls):\n> > +    def checkers(cls, names):\n> >          for checker in cls.subclasses:\n> > +            if names and checker.__name__ not in names:\n> > +                continue\n> >              yield checker\n> >  \n> >  \n> > @@ -436,8 +438,10 @@ class StyleChecker(metaclass=ClassRegistry):\n> >      # Class methods\n> >      #\n> >      @classmethod\n> > -    def checkers(cls, filename):\n> > +    def checkers(cls, filename, names):\n> >          for checker in cls.subclasses:\n> > +            if names and checker.__name__ not in names:\n> > +                continue\n> >              if checker.supports(filename):\n> >                  yield checker\n> >  \n> > @@ -617,8 +621,10 @@ class Formatter(metaclass=ClassRegistry):\n> >      # Class methods\n> >      #\n> >      @classmethod\n> > -    def formatters(cls, filename):\n> > +    def formatters(cls, filename, names):\n> >          for formatter in cls.subclasses:\n> > +            if names and formatter.__name__ not in names:\n> > +                continue\n> >              if formatter.supports(filename):\n> >                  yield formatter\n> >  \n> > @@ -780,7 +786,7 @@ class StripTrailingSpaceFormatter(Formatter):\n> >  # Style checking\n> >  #\n> >  \n> > -def check_file(top_level, commit, filename):\n> > +def check_file(top_level, commit, filename, checkers):\n> >      # Extract the line numbers touched by the commit.\n> >      commit_diff = commit.get_diff(top_level, filename)\n> >  \n> > @@ -797,7 +803,7 @@ def check_file(top_level, commit, filename):\n> >      after = commit.get_file(filename)\n> >  \n> >      formatted = after\n> > -    for formatter in Formatter.formatters(filename):\n> > +    for formatter in Formatter.formatters(filename, checkers):\n> >          formatted = formatter.format(filename, formatted)\n> >  \n> >      after = after.splitlines(True)\n> > @@ -811,7 +817,7 @@ def check_file(top_level, commit, filename):\n> >  \n> >      # Check for code issues not related to formatting.\n> >      issues = []\n> > -    for checker in StyleChecker.checkers(filename):\n> > +    for checker in StyleChecker.checkers(filename, checkers):\n> >          checker = checker(after)\n> >          for hunk in commit_diff:\n> >              issues += checker.check(hunk.side('to').touched)\n> > @@ -839,7 +845,7 @@ def check_file(top_level, commit, filename):\n> >      return len(formatted_diff) + len(issues)\n> >  \n> >  \n> > -def check_style(top_level, commit):\n> > +def check_style(top_level, commit, checkers):\n> >      separator = '-' * len(commit.title)\n> >      print(separator)\n> >      print(commit.title)\n> > @@ -848,7 +854,7 @@ def check_style(top_level, commit):\n> >      issues = 0\n> >  \n> >      # Apply the commit checkers first.\n> > -    for checker in CommitChecker.checkers():\n> > +    for checker in CommitChecker.checkers(checkers):\n> >          for issue in checker.check(commit, top_level):\n> >              print('%s%s%s' % (Colours.fg(Colours.Yellow), issue.msg, Colours.reset()))\n> >              issues += 1\n> > @@ -860,7 +866,7 @@ def check_style(top_level, commit):\n> >      files = [f for f in commit.files() if len([p for p in patterns if fnmatch.fnmatch(os.path.basename(f), p)])]\n> >  \n> >      for f in files:\n> > -        issues += check_file(top_level, commit, f)\n> > +        issues += check_file(top_level, commit, f, checkers)\n> >  \n> >      if issues == 0:\n> >          print('No issue detected')\n> > @@ -910,6 +916,8 @@ def main(argv):\n> >  \n> >      # Parse command line arguments\n> >      parser = argparse.ArgumentParser()\n> > +    parser.add_argument('--checkers', '-c', type=str,\n> > +                        help='Specify which checkers to run as a comma-separated list. Defaults to all checkers')\n> \n> Should we also want to add --list-checkers? it might be more convenient\n> than to have to browse the checkstyle.py code for finding the checker names.\n\nI've thought about it, and I don't mind, but I haven't implemented it as\nI've used this new argument to work on checkstyle.py only. I wanted to\nrun the new checker from this series on all commits in the history, and\nrunning all the checks would have been too slow (and would have\ngenerated too much noise). I'd expect someone who works on adding a new\nchecker to known the checker name :-)\n\n> >      parser.add_argument('--staged', '-s', action='store_true',\n> >                          help='Include the changes in the index. Defaults to False')\n> >      parser.add_argument('--amend', '-a', action='store_true',\n> > @@ -918,6 +926,9 @@ def main(argv):\n> >                          help='Revision range (as defined by git rev-parse). Defaults to HEAD if not specified.')\n> >      args = parser.parse_args(argv[1:])\n> >  \n> > +    if args.checkers:\n> > +        args.checkers = args.checkers.split(',')\n> > +\n> >      # Check for required dependencies.\n> >      for command, mandatory in dependencies.items():\n> >          found = shutil.which(command)\n> > @@ -951,7 +962,7 @@ def main(argv):\n> >  \n> >      issues = 0\n> >      for commit in commits:\n> > -        issues += check_style(top_level, commit)\n> > +        issues += check_style(top_level, commit, args.checkers)\n> >          print('')\n> >  \n> \n> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>\n> \n> >      if issues:","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 CFE0BBD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 16 Jun 2023 14:55:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 285C3628B7;\n\tFri, 16 Jun 2023 16:55:20 +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 288FD628AD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 16 Jun 2023 16:55:19 +0200 (CEST)","from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi\n\t[213.243.189.158])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C2E8AA49;\n\tFri, 16 Jun 2023 16:54:46 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1686927320;\n\tbh=98J8ilIf3cK7WdaZogyLgfL13jlwrAWbIryY2BaiMt4=;\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=WMxxwVmuXpDMk3zyJNyS4Vd9z5/C+zr8DE1vuVis/uRbGeHjilaqs/Yr+tErPS+N6\n\tU5GWOe8kArSeO0/jeHTBINF/g058zkQ1M+8wMxt9Z8kocqlwi5ZHyH6x4Tz25SN8gU\n\tENwv9ZDFC9LUsa4JiCTP0VkY6Sbl0CTBp39Wcej90Lwk/CJK7J2XvYeKa9EKXtI3E1\n\tO+Gi8fs04ZkEfx2grk/U26KSzZv5jpiUnTNWWU45wcV9rfbp31zfBcgZK3RURYdDiW\n\tfC77inCfh/dfMb15WJVGy+eS/JoIhTJ58mgt6G8jxKzceWOTPXGwkr9I8kBs7PvLsM\n\tCLAbm4w0KkcQQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1686927287;\n\tbh=98J8ilIf3cK7WdaZogyLgfL13jlwrAWbIryY2BaiMt4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=vdzZ6fknGJiDDaII7MB0/HiHKth4xXd6F9NIrPa+CdD9VLYpz2K3eAmfyAZZnjHE7\n\tBeOHazWKq4o2Z3ytN+NdJ8gMK47FLmnRYdXsivDlth8fMLDBxxNYY4GmZgwRbuTUcR\n\t4hTJtTKtK790v00AJft5mU2MFJyg2UAdyiXZKmVg="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"vdzZ6fkn\"; dkim-atps=neutral","Date":"Fri, 16 Jun 2023 17:55:18 +0300","To":"Mattijs Korpershoek <mkorpershoek@baylibre.com>","Message-ID":"<20230616145518.GG14547@pendragon.ideasonboard.com>","References":"<20230612224751.4437-1-laurent.pinchart@ideasonboard.com>\n\t<20230612224751.4437-3-laurent.pinchart@ideasonboard.com>\n\t<871qib8op3.fsf@baylibre.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<871qib8op3.fsf@baylibre.com>","Subject":"Re: [libcamera-devel] [PATCH v1 2/4] utils: checkstyle: Support\n\trunning checkers selectively","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>"}},{"id":27386,"web_url":"https://patchwork.libcamera.org/comment/27386/","msgid":"<87bkhb7wf4.fsf@baylibre.com>","date":"2023-06-19T07:17:51","subject":"Re: [libcamera-devel] [PATCH v1 2/4] utils: checkstyle: Support\n\trunning checkers selectively","submitter":{"id":153,"url":"https://patchwork.libcamera.org/api/people/153/","name":"Mattijs Korpershoek","email":"mkorpershoek@baylibre.com"},"content":"Hi Laurent,\n\nOn ven., juin 16, 2023 at 17:55, Laurent Pinchart <laurent.pinchart@ideasonboard.com> wrote:\n\n> Hi Mattijs,\n>\n> On Fri, Jun 16, 2023 at 04:30:16PM +0200, Mattijs Korpershoek wrote:\n>> On mar., juin 13, 2023 at 01:47, Laurent Pinchart via libcamera-devel wrote:\n>> \n>> > During development of the checkstyle.py script, it can be useful to run\n>> > only a subset of the checker. Add the ability to do so with a\n>> > '--checkers' command line argument.\n>> >\n>> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>> > ---\n>> >  utils/checkstyle.py | 31 +++++++++++++++++++++----------\n>> >  1 file changed, 21 insertions(+), 10 deletions(-)\n>> >\n>> > diff --git a/utils/checkstyle.py b/utils/checkstyle.py\n>> > index 7da888d8c365..3104acfa2065 100755\n>> > --- a/utils/checkstyle.py\n>> > +++ b/utils/checkstyle.py\n>> > @@ -301,8 +301,10 @@ class CommitChecker(metaclass=ClassRegistry):\n>> >      # Class methods\n>> >      #\n>> >      @classmethod\n>> > -    def checkers(cls):\n>> > +    def checkers(cls, names):\n>> >          for checker in cls.subclasses:\n>> > +            if names and checker.__name__ not in names:\n>> > +                continue\n>> >              yield checker\n>> >  \n>> >  \n>> > @@ -436,8 +438,10 @@ class StyleChecker(metaclass=ClassRegistry):\n>> >      # Class methods\n>> >      #\n>> >      @classmethod\n>> > -    def checkers(cls, filename):\n>> > +    def checkers(cls, filename, names):\n>> >          for checker in cls.subclasses:\n>> > +            if names and checker.__name__ not in names:\n>> > +                continue\n>> >              if checker.supports(filename):\n>> >                  yield checker\n>> >  \n>> > @@ -617,8 +621,10 @@ class Formatter(metaclass=ClassRegistry):\n>> >      # Class methods\n>> >      #\n>> >      @classmethod\n>> > -    def formatters(cls, filename):\n>> > +    def formatters(cls, filename, names):\n>> >          for formatter in cls.subclasses:\n>> > +            if names and formatter.__name__ not in names:\n>> > +                continue\n>> >              if formatter.supports(filename):\n>> >                  yield formatter\n>> >  \n>> > @@ -780,7 +786,7 @@ class StripTrailingSpaceFormatter(Formatter):\n>> >  # Style checking\n>> >  #\n>> >  \n>> > -def check_file(top_level, commit, filename):\n>> > +def check_file(top_level, commit, filename, checkers):\n>> >      # Extract the line numbers touched by the commit.\n>> >      commit_diff = commit.get_diff(top_level, filename)\n>> >  \n>> > @@ -797,7 +803,7 @@ def check_file(top_level, commit, filename):\n>> >      after = commit.get_file(filename)\n>> >  \n>> >      formatted = after\n>> > -    for formatter in Formatter.formatters(filename):\n>> > +    for formatter in Formatter.formatters(filename, checkers):\n>> >          formatted = formatter.format(filename, formatted)\n>> >  \n>> >      after = after.splitlines(True)\n>> > @@ -811,7 +817,7 @@ def check_file(top_level, commit, filename):\n>> >  \n>> >      # Check for code issues not related to formatting.\n>> >      issues = []\n>> > -    for checker in StyleChecker.checkers(filename):\n>> > +    for checker in StyleChecker.checkers(filename, checkers):\n>> >          checker = checker(after)\n>> >          for hunk in commit_diff:\n>> >              issues += checker.check(hunk.side('to').touched)\n>> > @@ -839,7 +845,7 @@ def check_file(top_level, commit, filename):\n>> >      return len(formatted_diff) + len(issues)\n>> >  \n>> >  \n>> > -def check_style(top_level, commit):\n>> > +def check_style(top_level, commit, checkers):\n>> >      separator = '-' * len(commit.title)\n>> >      print(separator)\n>> >      print(commit.title)\n>> > @@ -848,7 +854,7 @@ def check_style(top_level, commit):\n>> >      issues = 0\n>> >  \n>> >      # Apply the commit checkers first.\n>> > -    for checker in CommitChecker.checkers():\n>> > +    for checker in CommitChecker.checkers(checkers):\n>> >          for issue in checker.check(commit, top_level):\n>> >              print('%s%s%s' % (Colours.fg(Colours.Yellow), issue.msg, Colours.reset()))\n>> >              issues += 1\n>> > @@ -860,7 +866,7 @@ def check_style(top_level, commit):\n>> >      files = [f for f in commit.files() if len([p for p in patterns if fnmatch.fnmatch(os.path.basename(f), p)])]\n>> >  \n>> >      for f in files:\n>> > -        issues += check_file(top_level, commit, f)\n>> > +        issues += check_file(top_level, commit, f, checkers)\n>> >  \n>> >      if issues == 0:\n>> >          print('No issue detected')\n>> > @@ -910,6 +916,8 @@ def main(argv):\n>> >  \n>> >      # Parse command line arguments\n>> >      parser = argparse.ArgumentParser()\n>> > +    parser.add_argument('--checkers', '-c', type=str,\n>> > +                        help='Specify which checkers to run as a comma-separated list. Defaults to all checkers')\n>> \n>> Should we also want to add --list-checkers? it might be more convenient\n>> than to have to browse the checkstyle.py code for finding the checker names.\n>\n> I've thought about it, and I don't mind, but I haven't implemented it as\n> I've used this new argument to work on checkstyle.py only. I wanted to\n> run the new checker from this series on all commits in the history, and\n> running all the checks would have been too slow (and would have\n> generated too much noise). I'd expect someone who works on adding a new\n> checker to known the checker name :-)\n\nIndeed. Adding --list-checkers is definitely out of scope for this\npatch series.\n\nThanks for the explanation !\n\n>\n>> >      parser.add_argument('--staged', '-s', action='store_true',\n>> >                          help='Include the changes in the index. Defaults to False')\n>> >      parser.add_argument('--amend', '-a', action='store_true',\n>> > @@ -918,6 +926,9 @@ def main(argv):\n>> >                          help='Revision range (as defined by git rev-parse). Defaults to HEAD if not specified.')\n>> >      args = parser.parse_args(argv[1:])\n>> >  \n>> > +    if args.checkers:\n>> > +        args.checkers = args.checkers.split(',')\n>> > +\n>> >      # Check for required dependencies.\n>> >      for command, mandatory in dependencies.items():\n>> >          found = shutil.which(command)\n>> > @@ -951,7 +962,7 @@ def main(argv):\n>> >  \n>> >      issues = 0\n>> >      for commit in commits:\n>> > -        issues += check_style(top_level, commit)\n>> > +        issues += check_style(top_level, commit, args.checkers)\n>> >          print('')\n>> >  \n>> \n>> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>\n>> \n>> >      if issues:\n>\n> -- \n> Regards,\n>\n> Laurent Pinchart","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 72F72C3237\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 19 Jun 2023 07:17:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C7941628C3;\n\tMon, 19 Jun 2023 09:17:54 +0200 (CEST)","from mail-wr1-x433.google.com (mail-wr1-x433.google.com\n\t[IPv6:2a00:1450:4864:20::433])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3E2B4614FD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 19 Jun 2023 09:17:53 +0200 (CEST)","by mail-wr1-x433.google.com with SMTP id\n\tffacd0b85a97d-30adc51b65cso3165836f8f.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 19 Jun 2023 00:17:53 -0700 (PDT)","from localhost ([2a01:cb19:85e6:1900:2bf7:7388:731d:c4e1])\n\tby smtp.gmail.com with ESMTPSA id\n\tv4-20020a5d6784000000b0030fbf253c82sm22173015wru.104.2023.06.19.00.17.51\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 19 Jun 2023 00:17:52 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1687159074;\n\tbh=DW0tXjjk4uZiYoXSQu8qHZK34vo+MhgoB5h0CM6BA6c=;\n\th=To:In-Reply-To:References:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=2p+HpKz5UAxp36s1Dsex14THlwGFYYrCCo2Rmtvls4eWqanNG8/DyjeQGve2cRLIy\n\tBhsl8PB9z70nn3INK/Ly9vOsU0gxjLISiawOE5S3E/4I73UbCYFEP2PGOHBKWFJdyI\n\t1sVGoI/+/h0tOxWW03mJrGmY2OdEM6vooLZ7yKoXcdH/La328v4M3srDJyN7Y2ZWuO\n\tee+ou9g8rrsObFG9IJMbE3ZvNEdhafsVDJmWqV7YGv4MTPvTH3zhHBj3C9YgNIeiJR\n\t3++EyrCXgSDcr8OFGt0ily/DNPjpJ9RHRYZla17bNVucgD6l7TqqrB/7JPM4qP0bPv\n\t+MwQpPkEocd8w==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=baylibre-com.20221208.gappssmtp.com; s=20221208; t=1687159073;\n\tx=1689751073; \n\th=mime-version:message-id:date:references:in-reply-to:subject:cc:to\n\t:from:from:to:cc:subject:date:message-id:reply-to;\n\tbh=6K02cy7N0jMmGubgggqCHUZgJf5hkIPH193nzdTpvf0=;\n\tb=v3T1BUGj6K1koQAXOG42g9BGOLqJxU8v/yy+75Bs1SBz294MMHQFboRV/htOdqe0jb\n\ta1bSFx13uNZXn7Du+08BxeWXbD9b+y470wHX4eq+M/KHDn4vjCAITWbhLRyCEqAXouW3\n\trhy8ybyYMcthY48yIM1haLh/Gvmyr074TSDyLED8KkPaHHSmZT/1CrQTxhho9Cz4LTDa\n\tAKNGKlX0POft2CmFN5kCL0eAGro4eeCqUJ1zx0XBEoACorsMNTKs0o8UkfreBz3uHQ9t\n\t04IT48zr2S4Coy7OoT4pMi3/2Wc2BPkaZM/pUpq9bDxc/srTy+WNSXxf+PAC9keXzGEe\n\tHtJA=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=baylibre-com.20221208.gappssmtp.com\n\theader.i=@baylibre-com.20221208.gappssmtp.com header.b=\"v3T1BUGj\"; \n\tdkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20221208; t=1687159073; x=1689751073;\n\th=mime-version:message-id:date:references:in-reply-to:subject:cc:to\n\t:from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; \n\tbh=6K02cy7N0jMmGubgggqCHUZgJf5hkIPH193nzdTpvf0=;\n\tb=g2dSr44lBL7CTdT5B/LmHQQzDOGWe8CGOnkPnyMyGC+1Gvv5f9+xwnr9TsRuL+E4hR\n\tpcc7n357Ryh8bcZEp4k4bNXUAcJ1cFu9wFrAnW9/MIcpuOr6TtovE+RgCSERogKU1sH6\n\tj9rKu1j/a2Ey/6XnRGCUOzIVw28cAh3NCbV76Lg/fj+xpseGPIPB6EpDvlM8svN4dGOY\n\t91TnBkNpA+d874rRabr5e6BNAyeFJMOus8Sqhw0IV1ZN63tjnYabLcZfTWONYpkkObnH\n\tJLYiZt4RR2Vj5IgaEAwZU7qf4lRFDNRsAynP1vbwkD+TFwELEFtqNH8sRHhgu7YyRLaf\n\tnkWw==","X-Gm-Message-State":"AC+VfDylN1go5P6qO2td58h+97sKh56E+Gqwv8SXZAnBM/L4s1piQ7hF\n\tykv2V82L6oqD9NLlJVXyLcGju6pCYa5PBLCOlAKI5Q==","X-Google-Smtp-Source":"ACHHUZ75GnVIFX+0c3G1ORXw3yKq5q5InOgTmrLHRQhXlbDD7689sd7VQwnHqgVL97lvvkXtLp29Jg==","X-Received":"by 2002:a5d:456c:0:b0:306:2e04:5925 with SMTP id\n\ta12-20020a5d456c000000b003062e045925mr9497452wrc.17.1687159072544; \n\tMon, 19 Jun 2023 00:17:52 -0700 (PDT)","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","In-Reply-To":"<20230616145518.GG14547@pendragon.ideasonboard.com>","References":"<20230612224751.4437-1-laurent.pinchart@ideasonboard.com>\n\t<20230612224751.4437-3-laurent.pinchart@ideasonboard.com>\n\t<871qib8op3.fsf@baylibre.com>\n\t<20230616145518.GG14547@pendragon.ideasonboard.com>","Date":"Mon, 19 Jun 2023 09:17:51 +0200","Message-ID":"<87bkhb7wf4.fsf@baylibre.com>","MIME-Version":"1.0","Content-Type":"text/plain","Subject":"Re: [libcamera-devel] [PATCH v1 2/4] utils: checkstyle: Support\n\trunning checkers selectively","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":"Mattijs Korpershoek via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Mattijs Korpershoek <mkorpershoek@baylibre.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":27481,"web_url":"https://patchwork.libcamera.org/comment/27481/","msgid":"<168851586357.3885022.6575602759016777251@Monstersaurus>","date":"2023-07-05T00:11:03","subject":"Re: [libcamera-devel] [PATCH v1 2/4] utils: checkstyle: Support\n\trunning checkers selectively","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:49)\n> During development of the checkstyle.py script, it can be useful to run\n> only a subset of the checker. Add the ability to do so with a\n> '--checkers' command line argument.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  utils/checkstyle.py | 31 +++++++++++++++++++++----------\n>  1 file changed, 21 insertions(+), 10 deletions(-)\n> \n> diff --git a/utils/checkstyle.py b/utils/checkstyle.py\n> index 7da888d8c365..3104acfa2065 100755\n> --- a/utils/checkstyle.py\n> +++ b/utils/checkstyle.py\n> @@ -301,8 +301,10 @@ class CommitChecker(metaclass=ClassRegistry):\n>      # Class methods\n>      #\n>      @classmethod\n> -    def checkers(cls):\n> +    def checkers(cls, names):\n>          for checker in cls.subclasses:\n> +            if names and checker.__name__ not in names:\n\nSeems it was hard for me to see that 'names' can be null if\nargs.checkers is not set, but I found it in the end.\n\nAs suggested by Matti, a way to list the names might be useful - but as\nit's to allow running a single checker while the developer is working on\n/that/ checker - I can't see a reason to limit/filter otherwise right\nnow - I would want all capable checkers to run in the normal case so:\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> +                continue\n>              yield checker\n>  \n>  \n> @@ -436,8 +438,10 @@ class StyleChecker(metaclass=ClassRegistry):\n>      # Class methods\n>      #\n>      @classmethod\n> -    def checkers(cls, filename):\n> +    def checkers(cls, filename, names):\n>          for checker in cls.subclasses:\n> +            if names and checker.__name__ not in names:\n> +                continue\n>              if checker.supports(filename):\n>                  yield checker\n>  \n> @@ -617,8 +621,10 @@ class Formatter(metaclass=ClassRegistry):\n>      # Class methods\n>      #\n>      @classmethod\n> -    def formatters(cls, filename):\n> +    def formatters(cls, filename, names):\n>          for formatter in cls.subclasses:\n> +            if names and formatter.__name__ not in names:\n> +                continue\n>              if formatter.supports(filename):\n>                  yield formatter\n>  \n> @@ -780,7 +786,7 @@ class StripTrailingSpaceFormatter(Formatter):\n>  # Style checking\n>  #\n>  \n> -def check_file(top_level, commit, filename):\n> +def check_file(top_level, commit, filename, checkers):\n>      # Extract the line numbers touched by the commit.\n>      commit_diff = commit.get_diff(top_level, filename)\n>  \n> @@ -797,7 +803,7 @@ def check_file(top_level, commit, filename):\n>      after = commit.get_file(filename)\n>  \n>      formatted = after\n> -    for formatter in Formatter.formatters(filename):\n> +    for formatter in Formatter.formatters(filename, checkers):\n>          formatted = formatter.format(filename, formatted)\n>  \n>      after = after.splitlines(True)\n> @@ -811,7 +817,7 @@ def check_file(top_level, commit, filename):\n>  \n>      # Check for code issues not related to formatting.\n>      issues = []\n> -    for checker in StyleChecker.checkers(filename):\n> +    for checker in StyleChecker.checkers(filename, checkers):\n>          checker = checker(after)\n>          for hunk in commit_diff:\n>              issues += checker.check(hunk.side('to').touched)\n> @@ -839,7 +845,7 @@ def check_file(top_level, commit, filename):\n>      return len(formatted_diff) + len(issues)\n>  \n>  \n> -def check_style(top_level, commit):\n> +def check_style(top_level, commit, checkers):\n>      separator = '-' * len(commit.title)\n>      print(separator)\n>      print(commit.title)\n> @@ -848,7 +854,7 @@ def check_style(top_level, commit):\n>      issues = 0\n>  \n>      # Apply the commit checkers first.\n> -    for checker in CommitChecker.checkers():\n> +    for checker in CommitChecker.checkers(checkers):\n>          for issue in checker.check(commit, top_level):\n>              print('%s%s%s' % (Colours.fg(Colours.Yellow), issue.msg, Colours.reset()))\n>              issues += 1\n> @@ -860,7 +866,7 @@ def check_style(top_level, commit):\n>      files = [f for f in commit.files() if len([p for p in patterns if fnmatch.fnmatch(os.path.basename(f), p)])]\n>  \n>      for f in files:\n> -        issues += check_file(top_level, commit, f)\n> +        issues += check_file(top_level, commit, f, checkers)\n>  \n>      if issues == 0:\n>          print('No issue detected')\n> @@ -910,6 +916,8 @@ def main(argv):\n>  \n>      # Parse command line arguments\n>      parser = argparse.ArgumentParser()\n> +    parser.add_argument('--checkers', '-c', type=str,\n> +                        help='Specify which checkers to run as a comma-separated list. Defaults to all checkers')\n>      parser.add_argument('--staged', '-s', action='store_true',\n>                          help='Include the changes in the index. Defaults to False')\n>      parser.add_argument('--amend', '-a', action='store_true',\n> @@ -918,6 +926,9 @@ def main(argv):\n>                          help='Revision range (as defined by git rev-parse). Defaults to HEAD if not specified.')\n>      args = parser.parse_args(argv[1:])\n>  \n> +    if args.checkers:\n> +        args.checkers = args.checkers.split(',')\n> +\n>      # Check for required dependencies.\n>      for command, mandatory in dependencies.items():\n>          found = shutil.which(command)\n> @@ -951,7 +962,7 @@ def main(argv):\n>  \n>      issues = 0\n>      for commit in commits:\n> -        issues += check_style(top_level, commit)\n> +        issues += check_style(top_level, commit, args.checkers)\n>          print('')\n>  \n>      if issues:\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 CA6C5BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  5 Jul 2023 00:11:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 39202628BB;\n\tWed,  5 Jul 2023 02:11:08 +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 983E161E38\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  5 Jul 2023 02:11:06 +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 EE5B2DC9;\n\tWed,  5 Jul 2023 02:10:21 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1688515868;\n\tbh=/1XS09HmJTHTbBhGbQAzaIFX9tBGUq/sV7Tuj7ptf50=;\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=RqQ0IeJFwjJ+PKlNNeU2IESt3DBZpqamiCWTWk7vGHjbfosKCIpXAfNtFTDvzi905\n\thXhARMy+itBoMNSQHsln2YYwzMTfnIwhFuvp+pE7mOvYbcHm14Gx5l8wg91VMY6+Xi\n\tYobTsNNoc+I0ahB3qM1v2SaNXTZjFTWVylUwhQ1kloKHtO+Hdl5krcq/R1zLoMA8AN\n\tSOoU6jN06BJpKpTuiG15MuN+zHtjnC3x3haxc9P0fgZmPHNeVmSok04mUwjYA4Uos+\n\tB+2RpycklOEzSiKRCF5qIVvfA2s0Jhpjwq4w+HDnS8TV0IVLEbwAun/ev6PRTrguGD\n\tLyJVLPb0dBZzg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1688515822;\n\tbh=/1XS09HmJTHTbBhGbQAzaIFX9tBGUq/sV7Tuj7ptf50=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=s4H2ftke7ZrUB3ZlGb9PAE6u5H4E9t+n1hsKcKR5/Y+lwbX7IdHqTFfyulrRaHoWf\n\tT5ve8pHK960p32PCiQ8Xc0AOewkGK0a0XZDWpPo+SwdSOnLSUPCSmHvuimiW8vgHEX\n\t5JbfGhoBqRstYyUHERpsD2Xm08KYHfAB3kZ1cgdY="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"s4H2ftke\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20230612224751.4437-3-laurent.pinchart@ideasonboard.com>","References":"<20230612224751.4437-1-laurent.pinchart@ideasonboard.com>\n\t<20230612224751.4437-3-laurent.pinchart@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Wed, 05 Jul 2023 01:11:03 +0100","Message-ID":"<168851586357.3885022.6575602759016777251@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v1 2/4] utils: checkstyle: Support\n\trunning checkers selectively","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>"}}]