Patch Detail
Show a patch.
GET /api/patches/2213/?format=api
{ "id": 2213, "url": "https://patchwork.libcamera.org/api/patches/2213/?format=api", "web_url": "https://patchwork.libcamera.org/patch/2213/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/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": "<20191023135258.32256-3-laurent.pinchart@ideasonboard.com>", "date": "2019-10-23T13:52:57", "name": "[libcamera-devel,3/4] utils: checkstyle.py: Add include checker", "commit_ref": "bb5f8cf4951fc5813d60ab806c57c5b5d713f38c", "pull_url": null, "state": "accepted", "archived": false, "hash": "9fdd49fca1fa9207f8d92f8d9d845a69869b26c5", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/2213/mbox/", "series": [ { "id": 543, "url": "https://patchwork.libcamera.org/api/series/543/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=543", "date": "2019-10-23T13:52:55", "name": "[libcamera-devel,1/4] Documentation: coding-style: Document usage of C compatibility headers", "version": 1, "mbox": "https://patchwork.libcamera.org/series/543/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/2213/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/2213/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@ideasonboard.com>", "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6AAF06138F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Oct 2019 15:54:01 +0200 (CEST)", "from pendragon.ideasonboard.com (143.121.2.93.rev.sfr.net\n\t[93.2.121.143])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 11169A24\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Oct 2019 15:54:01 +0200 (CEST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1571838841;\n\tbh=DxRBXOFYmDhQwqHU0Iuu5vpN/Q10ulADw5PZNF8qoR8=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=YSHoydqyje2yDzp5wH6YDFSf/BtFqj62g7pkcBYfuCdahMnzpgwPZdROjPtxW4Flu\n\too5eNDn35K5J9p2Vk6Qub0R0thTZQ7ypzPhExEgVWRXftCFSDSI00yuQDlZU4RqUNV\n\t1Fx5shRa+he/GsO11IeB2z4FPstWob7tgmt84rVM=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 23 Oct 2019 16:52:57 +0300", "Message-Id": "<20191023135258.32256-3-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.23.0", "In-Reply-To": "<20191023135258.32256-1-laurent.pinchart@ideasonboard.com>", "References": "<20191023135258.32256-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 3/4] utils: checkstyle.py: Add include\n\tchecker", "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": "Wed, 23 Oct 2019 13:54:01 -0000" }, "content": "---\n utils/checkstyle.py | 32 ++++++++++++++++++++++++++++++++\n 1 file changed, 32 insertions(+)", "diff": "diff --git a/utils/checkstyle.py b/utils/checkstyle.py\nindex 42a96f6d6102..335e58f5fddf 100755\n--- a/utils/checkstyle.py\n+++ b/utils/checkstyle.py\n@@ -240,6 +240,38 @@ class StyleIssue(object):\n self.msg = msg\n \n \n+class IncludeChecker(StyleChecker):\n+ patterns = ('*.cpp', '*.h')\n+\n+ headers = ('assert', 'ctype', 'errno', 'fenv', 'float', 'inttypes',\n+ 'limits', 'locale', 'math', 'setjmp', 'signal', 'stdarg',\n+ 'stddef', 'stdint', 'stdio', 'stdlib', 'string', 'time', 'uchar',\n+ 'wchar', 'wctype')\n+ include_regex = re.compile('^#include <c([a-z]*)>')\n+\n+ def __init__(self, content):\n+ super().__init__()\n+ self.__content = content\n+\n+ def check(self, line_numbers):\n+ issues = []\n+\n+ for line_number in line_numbers:\n+ line = self.__content[line_number - 1]\n+ match = IncludeChecker.include_regex.match(line)\n+ if not match:\n+ continue\n+\n+ header = match.group(1)\n+ if header not in IncludeChecker.headers:\n+ continue\n+\n+ issues.append(StyleIssue(line_number, line,\n+ 'C compatibility header <%s.h> is preferred' % header))\n+\n+ return issues\n+\n+\n class LogCategoryChecker(StyleChecker):\n log_regex = re.compile('\\\\bLOG\\((Debug|Info|Warning|Error|Fatal)\\)')\n patterns = ('*.cpp',)\n", "prefixes": [ "libcamera-devel", "3/4" ] }