[cfe-dev] [GSoC 2012] Coding style checker proposal

ILya Pupatenko pupatenko at gmail.com
Thu Apr 5 12:31:09 PDT 2012

Dear LLVM/Clang community,

I am awfully sorry to make my proposal so late but it was only
yesterday when I was told about GSoC. So I decided that even if I have
a little time before deadline, I should just give a try. I’ll describe
the main idea of the proposal here and I would be thankful for any

One of the possible applications of Clang would be checking if the
code is written well enough to be, for example, added to project
codebase. Of course it is extremely difficult to determine code
quality automatically, but at least it is possible to check if the
code confirms the current coding standard (or may be just part of this
standard). And this check is what I’d like to implement.
Different coding style guides exist at the moment, for example Google
has one [1], LLVM has own standard [2] and also many projects and
companies have own coding rules, standards or style guides. Checking
number of coding rules requires deep understanding of the code
analyzed. It is not trivial even to check indentation of the code, and
some checks can be really complicated. So the ability to use Clang
preprocessor/parser/ASTs/etc. would be extremely useful.

There are some tasks need to be done to implement the code style checker.
1) It is important to determine flexible and general way to declare
coding standards as a collection of different rules. Some often-used
basic rules should be determined.
2) Every check should be implemented separately and independently.
That’s why some code to check standard selected, call corresponding
checks (probably providing some parameters to them) and display/save
check results is needed.
3) Several basic checks are to be implemented.
4) Also an automatic standard-compliant formatting algorithm may be implemented.

This project is probably not very complicated but I suppose that
smaller task has greater chances to be finished successfully.

-- Ilya

[1] Google C++ Style Guide //
[2] LLVM Coding Standards // http://llvm.org/docs/CodingStandards.html

More information about the cfe-dev mailing list