Patch Detail
Show a patch.
GET /api/1.1/patches/1620/?format=api
{ "id": 1620, "url": "https://patchwork.libcamera.org/api/1.1/patches/1620/?format=api", "web_url": "https://patchwork.libcamera.org/patch/1620/", "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": "<20190704150658.18809-1-kieran.bingham@ideasonboard.com>", "date": "2019-07-04T15:06:58", "name": "[libcamera-devel,v2] utils: checkstyle.py: Add pep8 checker", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "d0502dcd883d0ebdc6ead1d6531dec7a069f5c5e", "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/1620/mbox/", "series": [ { "id": 406, "url": "https://patchwork.libcamera.org/api/1.1/series/406/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=406", "date": "2019-07-04T15:06:58", "name": "[libcamera-devel,v2] utils: checkstyle.py: Add pep8 checker", "version": 2, "mbox": "https://patchwork.libcamera.org/series/406/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/1620/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/1620/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 DE4DE61569\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 4 Jul 2019 17:07:02 +0200 (CEST)", "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 6F4E324B;\n\tThu, 4 Jul 2019 17:07:02 +0200 (CEST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1562252822;\n\tbh=oMftc4m+KDvWvCpDtRRHXVfM7xwXSAtIsNeRa9bbwo0=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=ev+lvf6N+wD/L1IaLzfM4lHlfxtunMDyBkn7rvGwoTuoQNoGzJE2BoXEq9NEuVPFE\n\t1XYEUeBoi6tctvdmsii1c1+Q3cw34JoRtIxjJaGN7NaEQPk12cVBmJxt53GUMXjer8\n\t5WqvXi4OcDnj8BoJmR2Mvm9tSlyovti8fdYrBiWU=", "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>", "To": "LibCamera Devel <libcamera-devel@lists.libcamera.org>", "Date": "Thu, 4 Jul 2019 16:06:58 +0100", "Message-Id": "<20190704150658.18809-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 v2] utils: checkstyle.py: Add pep8 checker", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.23", "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": "Thu, 04 Jul 2019 15:07:03 -0000" }, "content": "Process python additions with pep8 and report any errors that are added.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n--\nv2:\n - Now catches if pep8 is not available\n - line_no_regex renamed to results_regex and contained in Pep8Checker\n class\n - Single quotes used instead of double quotes\n - 'data' moved to local variable instance of class instance\n---\n utils/checkstyle.py | 33 +++++++++++++++++++++++++++++++++\n 1 file changed, 33 insertions(+)", "diff": "diff --git a/utils/checkstyle.py b/utils/checkstyle.py\nindex fab4b116d2ff..c5ecdc12112b 100755\n--- a/utils/checkstyle.py\n+++ b/utils/checkstyle.py\n@@ -276,6 +276,39 @@ class MesonChecker(StyleChecker):\n return issues\n \n \n+class Pep8Checker(StyleChecker):\n+ patterns = ('*.py',)\n+ results_regex = re.compile('stdin:([0-9]+):([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(['pep8', '--ignore=E501', '-'],\n+ input=data, stdout=subprocess.PIPE)\n+ except FileNotFoundError:\n+ issues.append(StyleIssue(0, '', \"Please install pep8 to validate python additions\"))\n+ return issues\n+\n+ results = ret.stdout.decode('utf-8').splitlines()\n+ for item in results:\n+ search = re.search(Pep8Checker.results_regex, item)\n+ line_number = int(search.group(1))\n+ position = int(search.group(2))\n+ msg = search.group(3)\n+\n+ if line_number in line_numbers:\n+ line = self.__content[line_number - 1]\n+ issues.append(StyleIssue(line_number, line, msg))\n+\n+ return issues\n+\n+\n # ------------------------------------------------------------------------------\n # Formatters\n #\n", "prefixes": [ "libcamera-devel", "v2" ] }