{"id":2521,"url":"https://patchwork.libcamera.org/api/patches/2521/?format=json","web_url":"https://patchwork.libcamera.org/patch/2521/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200107154442.17372-3-kieran.bingham@ideasonboard.com>","date":"2020-01-07T15:44:41","name":"[libcamera-devel,2/2] utils: checkstyle.py: Support single line hunks","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"9f95bdf467d2e480b717e95fd41dbad37ae48b16","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/2521/mbox/","series":[{"id":605,"url":"https://patchwork.libcamera.org/api/series/605/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=605","date":"2020-01-07T15:44:39","name":"utils: checkstyle: Two checkstyle fixes","version":1,"mbox":"https://patchwork.libcamera.org/series/605/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2521/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2521/checks/","tags":{},"headers":{"Return-Path":"<kieran.bingham@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 E53A7605EF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  7 Jan 2020 16:44:46 +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 84DD2A46;\n\tTue,  7 Jan 2020 16:44:46 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1578411886;\n\tbh=C3W2HaY9yKH5eYgqyZZPEtuJGEy6Z8A1jlyaCVjuDS4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=e+slbIHdeEsvB1TuI8t8I7vFJI7AjgNVfLIMFV2SbzrnpS/HqryaeZD30TY4s50P5\n\t9iI6inZmwJsBKNM0gW1Cxg4UEZCDJbfMERpVlzOFPOGhdhDYnbK/Cs7kjeHV5k/886\n\tYW/etmXavFsOUrPGzz0WgnZmwhH09EjhGOdtOk6I=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"LibCamera Devel <libcamera-devel@lists.libcamera.org>","Date":"Tue,  7 Jan 2020 15:44:41 +0000","Message-Id":"<20200107154442.17372-3-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.20.1","In-Reply-To":"<20200107154442.17372-1-kieran.bingham@ideasonboard.com>","References":"<20200107154442.17372-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 2/2] utils: checkstyle.py: Support single\n\tline hunks","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":"Tue, 07 Jan 2020 15:44:47 -0000"},"content":"The checkstyle script expects hunks to be declared with a start line and\nline count, however the unified diff format [0] declares that a single\nline hunk will only have the start line:\n\n> If a hunk contains just one line, only its start line number appears.\n> Otherwise its line numbers look like ‘start,count’. An empty hunk is\n> considered to start at the line that follows the hunk.\n\n[0] https://www.gnu.org/software/diffutils/manual/html_node/Detailed-Unified.html#Detailed-Unified\n\nAttempting to parse a single line hunk results in the following error:\n\n  File \"./utils/checkstyle.py\", line 110, in __init__\n    raise RuntimeError(\"Malformed diff hunk header '%s'\" % line)\n  RuntimeError: Malformed diff hunk header '@@ -1 +1,2 @@\n\nThe DiffHunk class only makes use of the start line, and does not\nutilise the line count, thus update the regex to make the unused\ngroups optional, along with its comma separator.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n utils/checkstyle.py | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)","diff":"diff --git a/utils/checkstyle.py b/utils/checkstyle.py\nindex 41cd3371e81e..ab3b977358c7 100755\n--- a/utils/checkstyle.py\n+++ b/utils/checkstyle.py\n@@ -102,7 +102,7 @@ class DiffHunkSide(object):\n \n \n class DiffHunk(object):\n-    diff_header_regex = re.compile(r'@@ -([0-9]+),([0-9]+) \\+([0-9]+),([0-9]+) @@')\n+    diff_header_regex = re.compile(r'@@ -([0-9]+)(,[0-9]+)? \\+([0-9]+)(,?[0-9]+)? @@')\n \n     def __init__(self, line):\n         match = DiffHunk.diff_header_regex.match(line)\n","prefixes":["libcamera-devel","2/2"]}