{"id":2669,"url":"https://patchwork.libcamera.org/api/patches/2669/?format=json","web_url":"https://patchwork.libcamera.org/patch/2669/","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":"<20200118035448.230530-3-nicolas@ndufresne.ca>","date":"2020-01-18T03:54:44","name":"[libcamera-devel,v3,2/6] checkstyle: Exit with 1 status if issues are found","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"c26791bd05b5a4cb8a1074a46eaac9ade8ae5bc9","submitter":{"id":30,"url":"https://patchwork.libcamera.org/api/people/30/?format=json","name":"Nicolas Dufresne","email":"nicolas@ndufresne.ca"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/2669/mbox/","series":[{"id":635,"url":"https://patchwork.libcamera.org/api/series/635/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=635","date":"2020-01-18T03:54:42","name":"Add the ability to do pre-commit style check","version":3,"mbox":"https://patchwork.libcamera.org/series/635/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2669/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2669/checks/","tags":{},"headers":{"Return-Path":"<nicolas@ndufresne.ca>","Received":["from bhuna.collabora.co.uk (bhuna.collabora.co.uk\n\t[IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9B3E860452\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 18 Jan 2020 04:59:56 +0100 (CET)","from nicolas-tpx395.localdomain (unknown\n\t[IPv6:2002:c0de:c115:0:66fc:8b:2a38:8313])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits))\n\t(No client certificate requested) (Authenticated sender: nicolas)\n\tby bhuna.collabora.co.uk (Postfix) with ESMTPSA id B41812913C4;\n\tSat, 18 Jan 2020 03:59:51 +0000 (GMT)"],"From":"Nicolas Dufresne <nicolas@ndufresne.ca>","To":"libcamera-devel@lists.libcamera.org","Cc":"Nicolas Dufresne <nicolas.dufresne@collabora.com>, =?utf-8?q?Niklas_S?=\n\t=?utf-8?b?w7ZkZXJsdW5k?= <niklas.soderlund@ragnatech.se>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","Date":"Fri, 17 Jan 2020 22:54:44 -0500","Message-Id":"<20200118035448.230530-3-nicolas@ndufresne.ca>","X-Mailer":"git-send-email 2.24.1","In-Reply-To":"<20200118035448.230530-1-nicolas@ndufresne.ca>","References":"<20200118035448.230530-1-nicolas@ndufresne.ca>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 2/6] checkstyle: Exit with 1 status if\n\tissues are found","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":"Sat, 18 Jan 2020 03:59:56 -0000"},"content":"From: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n\nMakes the tool return 1 if there is any potential issues. This is\nneeded when using this tool for pre-commit hook in order to abort\nthe commit process.\n\nSigned-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n utils/checkstyle.py | 12 +++++++++---\n 1 file changed, 9 insertions(+), 3 deletions(-)","diff":"diff --git a/utils/checkstyle.py b/utils/checkstyle.py\nindex 7edea25..4a14309 100755\n--- a/utils/checkstyle.py\n+++ b/utils/checkstyle.py\n@@ -541,7 +541,7 @@ def check_style(top_level, commit):\n     files = [f for f in files if len([p for p in patterns if fnmatch.fnmatch(os.path.basename(f), p)])]\n     if len(files) == 0:\n         print(\"Commit doesn't touch source files, skipping\")\n-        return\n+        return 0\n \n     issues = 0\n     for f in files:\n@@ -554,6 +554,8 @@ def check_style(top_level, commit):\n         print(\"%u potential style %s detected, please review\" % \\\n                 (issues, 'issue' if issues == 1 else 'issues'))\n \n+    return issues\n+\n \n def extract_revlist(revs):\n     \"\"\"Extract a list of commits on which to operate from a revision or revision\n@@ -632,11 +634,15 @@ def main(argv):\n \n     revlist = extract_revlist(args.revision_range)\n \n+    issues = 0\n     for commit in revlist:\n-        check_style(top_level, commit)\n+        issues += check_style(top_level, commit)\n         print('')\n \n-    return 0\n+    if issues:\n+        return 1\n+    else:\n+        return 0\n \n \n if __name__ == '__main__':\n","prefixes":["libcamera-devel","v3","2/6"]}