<br><br><div class="gmail_quote">Le 6 avril 2012 11:00, Holtgrewe, Manuel <span dir="ltr"><<a href="mailto:manuel.holtgrewe@fu-berlin.de" target="_blank">manuel.holtgrewe@fu-berlin.de</a>></span> a écrit :<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Two cents from my side:<br>
<br>
A while back, I started to implement a code checker based on the Python interface to libclang which was inspired by the Java Checkstyle tool. You can find it here:<br>
<br>
<a href="https://github.com/holtgrewe/linty" target="_blank">https://github.com/holtgrewe/linty</a><br>
<br>
Meanwhile, I think, the official python bindings to libclang have been replaced.<br>
<br>
I am in no position for mentoring a style checker based on clang but I could offer for someone who wants to do this to pick my mind on my experience (Mainly: Probably don't do it in Python since it's slow for large programs and the interface exposed by libclang is not rich enough).<br>


<br>
Cheers!<br>
<br>
Manuel<br>
________________________________________<br>
From: <a href="mailto:cfe-dev-bounces@cs.uiuc.edu" target="_blank">cfe-dev-bounces@cs.uiuc.edu</a> [<a href="mailto:cfe-dev-bounces@cs.uiuc.edu" target="_blank">cfe-dev-bounces@cs.uiuc.edu</a>] on behalf of Henry Miller [<a href="mailto:hank@millerfarm.com" target="_blank">hank@millerfarm.com</a>]<br>


Sent: Friday, April 06, 2012 3:33 AM<br>
To: <a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
Subject: Re: [cfe-dev] [GSoC 2012] Coding style checker proposal<br>
<div><div><br>
I suspect you will get some negatives from those who know better than me,<br>
appearantly there are things in work that would make the code much different.<br>
<br>
Still on the off chance someone agrees to mentor you on this, I thought I'd<br>
give you some encouragement.  We really could use this where I work - some<br>
people are big on style, which is nice in a lot of ways, but really a pain.<br>
It would be nice if something would tell us where things are wrong.<br>
<br>
I encourage you for the first part to start with a configuration that is<br>
compatible with uncrustify.  A large part of our style problems disappeared<br>
once we forced a good uncrustify config on everyone.   What remains is mostly<br>
things like variable names.  (a class member starts with upper case and is<br>
CamelCase, while a local starts with lowercase...)<br>
<br>
So please do continue this, but also pay attention to what others are doing as<br>
far as an indent type replacement so we don't end up with tools that don't<br>
work well together.<br>
<br>
On Thursday 05 April 2012 14:31:09 ILya Pupatenko wrote:<br>
> Dear LLVM/Clang community,<br>
><br>
> I am awfully sorry to make my proposal so late but it was only<br>
> yesterday when I was told about GSoC. So I decided that even if I have<br>
> a little time before deadline, I should just give a try. I’ll describe<br>
> the main idea of the proposal here and I would be thankful for any<br>
> comments.<br>
><br>
> One of the possible applications of Clang would be checking if the<br>
> code is written well enough to be, for example, added to project<br>
> codebase. Of course it is extremely difficult to determine code<br>
> quality automatically, but at least it is possible to check if the<br>
> code confirms the current coding standard (or may be just part of this<br>
> standard). And this check is what I’d like to implement.<br>
> Different coding style guides exist at the moment, for example Google<br>
> has one [1], LLVM has own standard [2] and also many projects and<br>
> companies have own coding rules, standards or style guides. Checking<br>
> number of coding rules requires deep understanding of the code<br>
> analyzed. It is not trivial even to check indentation of the code, and<br>
> some checks can be really complicated. So the ability to use Clang<br>
> preprocessor/parser/ASTs/etc. would be extremely useful.<br>
><br>
> There are some tasks need to be done to implement the code style checker.<br>
> 1) It is important to determine flexible and general way to declare<br>
> coding standards as a collection of different rules. Some often-used<br>
> basic rules should be determined.<br>
> 2) Every check should be implemented separately and independently.<br>
> That’s why some code to check standard selected, call corresponding<br>
> checks (probably providing some parameters to them) and display/save<br>
> check results is needed.<br>
> 3) Several basic checks are to be implemented.<br>
> 4) Also an automatic standard-compliant formatting algorithm may be<br>
> implemented.<br>
><br>
> This project is probably not very complicated but I suppose that<br>
> smaller task has greater chances to be finished successfully.<br>
><br>
> -- Ilya<br>
><br>
> [1] Google C++ Style Guide //<br>
> <a href="http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml" target="_blank">http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml</a><br>
> [2] LLVM Coding Standards // <a href="http://llvm.org/docs/CodingStandards.html" target="_blank">http://llvm.org/docs/CodingStandards.html</a><br>
><br></div></div></blockquote></div><br>This is certainly a very good idea (especially the reformatting), having this run prior to commits would really help in avoiding "style-warts" and would greatly simplify the life of contributors since each project has its own guidelines...<br>

<br>As said, the tooling architecture is being reworked to facilitate writing tool (automating most of the process), Manuel Klimek from Google is leading the effort. I have attempted to put him in copy so he can chip in and tell you how much is done/is left.<br>
<br>-- Matthieu<br>