Show a patch.

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

{
    "id": 3116,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/3116/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/3116/",
    "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": "<20200316132121.23330-1-kieran.bingham@ideasonboard.com>",
    "date": "2020-03-16T13:21:21",
    "name": "[libcamera-devel] utils: checkstyle: Add a ShellChecker",
    "commit_ref": "d15f979ead99fd0b2acc7cbe5bd1375d7c6df706",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "b54c7520a23d11e11626e32b1913d2f82d3630d3",
    "submitter": {
        "id": 4,
        "url": "https://patchwork.libcamera.org/api/1.1/people/4/?format=api",
        "name": "Kieran Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/3116/mbox/",
    "series": [
        {
            "id": 723,
            "url": "https://patchwork.libcamera.org/api/1.1/series/723/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=723",
            "date": "2020-03-16T13:21:21",
            "name": "[libcamera-devel] utils: checkstyle: Add a ShellChecker",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/723/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/3116/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/3116/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<kieran.bingham@ideasonboard.com>",
        "Received": [
            "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 8EBAA6041A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Mar 2020 14:21:25 +0100 (CET)",
            "from localhost.localdomain\n\t(cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0BC7DA3B;\n\tMon, 16 Mar 2020 14:21:24 +0100 (CET)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1584364885;\n\tbh=OdJO/IwUjNpnKpDiAAqvdTgWSD4UykLOtGk3HWIMw7U=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=gv2HTUC05r0rCu+Jq6h34fqVTumGADBiCDxXVn+TkIdvZ14pnDG9har5XWZ4sFEid\n\t1Iju/NH9JsUimBmYsUP+FC9mSgNDsXyZrXMi4wg8iN5EBLO0LoGR0lhmElNPCnPOug\n\tDMPWZbwb1jUNjX4Rawpm4v1vcrBHFmd0czWVWdq4=",
        "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "To": "libcamera devel <libcamera-devel@lists.libcamera.org>",
        "Date": "Mon, 16 Mar 2020 13:21:21 +0000",
        "Message-Id": "<20200316132121.23330-1-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH] utils: checkstyle: Add a ShellChecker",
        "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>",
        "X-List-Received-Date": "Mon, 16 Mar 2020 13:21:25 -0000"
    },
    "content": "Hook the utility 'shellcheck' into our checkstyle helper to\nautomatically verify shell script additions.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n utils/checkstyle.py | 38 ++++++++++++++++++++++++++++++++++++++\n 1 file changed, 38 insertions(+)",
    "diff": "diff --git a/utils/checkstyle.py b/utils/checkstyle.py\nindex 5ac14508bad5..0827a1e6ba0f 100755\n--- a/utils/checkstyle.py\n+++ b/utils/checkstyle.py\n@@ -341,6 +341,44 @@ class Pep8Checker(StyleChecker):\n         return issues\n \n \n+class ShellChecker(StyleChecker):\n+    patterns = ('*.sh',)\n+    results_line_regex = re.compile('In - line ([0-9]+):')\n+\n+    def __init__(self, content):\n+        super().__init__()\n+        self.__content = content\n+\n+    def check(self, line_numbers):\n+        issues = []\n+        data = ''.join(self.__content).encode('utf-8')\n+\n+        try:\n+            ret = subprocess.run(['shellcheck', '-Cnever', '-'],\n+                                 input=data, stdout=subprocess.PIPE)\n+        except FileNotFoundError:\n+            issues.append(StyleIssue(0, None, \"Please install shellcheck to validate shell script additions\"))\n+            return issues\n+\n+        results = ret.stdout.decode('utf-8').splitlines()\n+        for nr, item in enumerate(results):\n+            search = re.search(ShellChecker.results_line_regex, item)\n+            if search is None:\n+                continue\n+\n+            line_number = int(search.group(1))\n+            line = results[nr + 1]\n+            msg = results[nr + 2]\n+\n+            # Determined, but not yet used\n+            position = msg.find('^') + 1\n+\n+            if line_number in line_numbers:\n+                issues.append(StyleIssue(line_number, line, msg))\n+\n+        return issues\n+\n+\n # ------------------------------------------------------------------------------\n # Formatters\n #\n",
    "prefixes": [
        "libcamera-devel"
    ]
}