{"id":52,"url":"https://patchwork.libcamera.org/api/patches/52/?format=json","web_url":"https://patchwork.libcamera.org/patch/52/","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":"<20181214133216.18375-2-laurent.pinchart@ideasonboard.com>","date":"2018-12-14T13:32:16","name":"[libcamera-devel,v2,2/2] Documentation: Document the style check script","commit_ref":"17fab5dfc8721d133c71adbd135410012898b409","pull_url":null,"state":"accepted","archived":false,"hash":"546f0ad21583863ef368a0d2f2dcb2db8decc525","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/52/mbox/","series":[{"id":27,"url":"https://patchwork.libcamera.org/api/series/27/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=27","date":"2018-12-14T13:32:16","name":"[libcamera-devel,v2,1/2] utils: Add Python-based commit style checker script","version":2,"mbox":"https://patchwork.libcamera.org/series/27/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/52/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/52/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 B371260B0C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 14 Dec 2018 14:31:34 +0100 (CET)","from avalon.bb.dnainternet.fi\n\t(dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 46F7D5A9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 14 Dec 2018 14:31:33 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1544794293;\n\tbh=cP+2C8H9AZ/zmwhGKlnuoAHHUlSa5dueA/5Y2hm6PtI=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=o7dgMff9S3QOrKa/APPs5xKOI4kCekSptWA2oWGgpUlRpHFGMVGAdQA18uBM5Nas7\n\tvdPq3Ykx7nXgUYvnQrEL+83pSLVxaYtz6LMXeIoq9clVJQXKnuBk4kvdlKLd755Jsj\n\th6S5GAG/+FG9VRQSCa14xrZq1P8g+eIH0b0y07Rs=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 14 Dec 2018 15:32:16 +0200","Message-Id":"<20181214133216.18375-2-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.19.2","In-Reply-To":"<20181214133216.18375-1-laurent.pinchart@ideasonboard.com>","References":"<20181214133216.18375-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 2/2] Documentation: Document the style\n\tcheck script","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":"Fri, 14 Dec 2018 13:31:34 -0000"},"content":"From: Jacopo Mondi <jacopo@jmondi.org>\n\nAdd a section to the coding style documentation to explain usage of the\ncheckstyle.py script.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n Documentation/coding-style.rst | 113 +++++++++++++++++++++++++++++++++\n 1 file changed, 113 insertions(+)","diff":"diff --git a/Documentation/coding-style.rst b/Documentation/coding-style.rst\nindex 1b67abed3a53..55e195cfc368 100644\n--- a/Documentation/coding-style.rst\n+++ b/Documentation/coding-style.rst\n@@ -79,3 +79,116 @@ C++-11-specific features:\n * General-purpose smart pointers (std::unique_ptr), deprecating std::auto_ptr.\n   Smart pointers, as well as shared pointers and weak pointers, shall not be\n   overused.\n+\n+\n+Tools\n+-----\n+\n+The 'astyle' code formatting tool can be used to reformat source files with the\n+libcamera coding style, defined by the following arguments.\n+\n+::\n+\n+  --style=linux\n+  --indent=force-tab=8\n+  --attach-namespaces\n+  --attach-extern-c\n+  --pad-oper\n+  --align-pointer=name\n+  --align-reference=name\n+  --max-code-length=120\n+\n+As astyle is a code formatter, it operates on full files outputs reformatted\n+source code. While it can be used to reformat code before sending patches, it\n+may generate unrelated changes. To avoid this, libcamera provides a\n+'checkstyle.py' script wrapping astyle to only retain related changes. This\n+should be used to validate modifications before submitting them for review.\n+\n+The script operates on one or multiple git commits specified on the command\n+line. It does not modify the git tree, the index or the working directory and\n+is thus safe to run at any point.\n+\n+Commits are specified using the same revision range syntax as 'git log'. The\n+most usual use cases are to specify a single commit by sha1, branch name or tag\n+name, or a commit range with the <from>..<to> syntax. When no arguments are\n+given, the topmost commit of the current branch is selected.\n+\n+::\n+\n+\t$ ./utils/checkstyle.py cc7d204b2c51\n+\t----------------------------------------------------------------------------------\n+\tcc7d204b2c51853f7d963d144f5944e209e7ea29 libcamera: Use the logger instead of cout\n+\t----------------------------------------------------------------------------------\n+\tNo style issue detected\n+\n+When operating on a range of commits, style checks are performed on each commit\n+from oldest to newest.\n+\n+::\n+\n+\t$ ../utils/checkstyle.py 3b56ddaa96fb~3..3b56ddaa96fb\n+\t----------------------------------------------------------------------------------\n+\tb4351e1a6b83a9cfbfc331af3753602a02dbe062 libcamera: log: Fix Doxygen documentation\n+\t----------------------------------------------------------------------------------\n+\tNo style issue detected\n+\t\n+\t--------------------------------------------------------------------------------------\n+\t6ab3ff4501fcfa24db40fcccbce35bdded7cd4bc libcamera: log: Document the LogMessage class\n+\t--------------------------------------------------------------------------------------\n+\tNo style issue detected\n+\t\n+\t---------------------------------------------------------------------------------\n+\t3b56ddaa96fbccf4eada05d378ddaa1cb6209b57 build: Add 'std=c++11' cpp compiler flag\n+\t---------------------------------------------------------------------------------\n+\tCommit doesn't touch source files, skipping\n+\n+Commits that do not touch any .c, .cpp or .h files are skipped.\n+\n+::\n+\n+\t$ ./utils/checkstyle.py edbd2059d8a4\n+\t----------------------------------------------------------------------\n+\tedbd2059d8a4bd759302ada4368fa4055638fd7f libcamera: Add initial logger\n+\t----------------------------------------------------------------------\n+\t--- src/libcamera/include/log.h\n+\t+++ src/libcamera/include/log.h\n+\t@@ -21,11 +21,14 @@\n+\t {\n+\t public:\n+\t        LogMessage(const char *fileName, unsigned int line,\n+\t-                 LogSeverity severity);\n+\t-       LogMessage(const LogMessage&) = delete;\n+\t+                  LogSeverity severity);\n+\t+       LogMessage(const LogMessage &) = delete;\n+\t        ~LogMessage();\n+\t \n+\t-       std::ostream& stream() { return msgStream; }\n+\t+       std::ostream &stream()\n+\t+       {\n+\t+               return msgStream;\n+\t+       }\n+\t \n+\t private:\n+\t        std::ostringstream msgStream;\n+\t \n+\t--- src/libcamera/log.cpp\n+\t+++ src/libcamera/log.cpp\n+\t@@ -42,7 +42,7 @@\n+\t \n+\t static const char *log_severity_name(LogSeverity severity)\n+\t {\n+\t-       static const char * const names[] = {\n+\t+       static const char *const names[] = {\n+\t                \"INFO\",\n+\t                \"WARN\",\n+\t                \" ERR\",\n+\t\n+\t---\n+\t2 potential style issues detected, please review\n+\n+When potential style issues are detected, they are displayed in the form of a\n+diff that fixes the issues, on top of the corresponding commit. As the script is\n+in early development false positive are expected. The flagged issues should be\n+reviewed, but the diff doesn't need to be applied blindly.\n+\n+Happy hacking, libcamera awaits your patches!\n","prefixes":["libcamera-devel","v2","2/2"]}