Show a patch.

GET /api/1.1/patches/18728/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 18728,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/18728/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18728/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20230612224751.4437-3-laurent.pinchart@ideasonboard.com>",
    "date": "2023-06-12T22:47:49",
    "name": "[libcamera-devel,v1,2/4] utils: checkstyle: Support running checkers selectively",
    "commit_ref": "69e3983acf416b48aaa609f9df45e66c32e3f39d",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "c2930c0fc53c9deb4afd3f8af071bab5947cf40c",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/18728/mbox/",
    "series": [
        {
            "id": 3920,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3920/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3920",
            "date": "2023-06-12T22:47:47",
            "name": "utils: checkstyle: Add a commit message trailers checker",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3920/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18728/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18728/checks/",
    "tags": {},
    "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 784FAC31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 12 Jun 2023 22:47:56 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4C9716289F;\n\tTue, 13 Jun 2023 00:47:56 +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 9D51F6020C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Jun 2023 00:47:54 +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 CF9B4D80\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Jun 2023 00:47:24 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1686610076;\n\tbh=pFFY84X4S/spKigWytzPQVbkgxCjjLhWG9Rj+tMYnds=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=ick64gzLzY4S35vLNuOcxy6YnGu6AbS5cmt3rUcmvHcunw1u+AY1zclfc1M6mJ+Kx\n\tazw9xeVNe14B2PQzpaMtuQze4vdA9otFR8sUkLCH8F2KHGjXmcj4CGWkgDOqc1T8dU\n\t5mfwEfveHwUx6HCqM0CqbDJli9v5SJpNyBvP3uJdW/TMr/0pcctsVUwzm57utFPZ5g\n\tLE6bsnz6ffBD0wnp5H59EmRQnLKhNKIHB/sV7kreW33cfsS+FowRDVqk+SsCJ4TU8n\n\tFItGbiBJzpH+VekpiVDO8e/7GbIxKbi6+7U25ZIbgfr59GsUH2AKUuz1hSjjPbHE3F\n\tTDh6ysZfK7jsg==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1686610045;\n\tbh=pFFY84X4S/spKigWytzPQVbkgxCjjLhWG9Rj+tMYnds=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=mSJjXB70M5gWssCOmrC7fcJQVDnY0QtgqiMJDHKcYoRsC10vLZru1q08qFvbRXCJr\n\tFckUDDbxG1LFc9ex/LtiILTsKj1kixM48OwG/397+1jFkntbPEL58oGnemjMW/oJBb\n\tc/HRfhPhkvw7A51sUp7f2BqMb6eBYSn7L8SbzJog="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"mSJjXB70\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 13 Jun 2023 01:47:49 +0300",
        "Message-Id": "<20230612224751.4437-3-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.39.3",
        "In-Reply-To": "<20230612224751.4437-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20230612224751.4437-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v1 2/4] utils: checkstyle: Support running\n\tcheckers 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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "During development of the checkstyle.py script, it can be useful to run\nonly a subset of the checker. Add the ability to do so with a\n'--checkers' command line argument.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n utils/checkstyle.py | 31 +++++++++++++++++++++----------\n 1 file changed, 21 insertions(+), 10 deletions(-)",
    "diff": "diff --git a/utils/checkstyle.py b/utils/checkstyle.py\nindex 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     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",
    "prefixes": [
        "libcamera-devel",
        "v1",
        "2/4"
    ]
}