[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Xen checkpatch infrastructure design

Hello Juergen,

I've started to work on checkpatch-like python script. I make it based on  clang-format-diff.py and it works as pre-commit hook. 

> The easiest way to accomplish that is a file in the repository's root
> directory containing the necessary information. It will be named
> "STYLES" and contains lines in the format:

I will follow this approach.

> Remains the question how to design the style checker itself. It could
> be:
> (a) a monolithic script (perl, python, whatever) being capable of
>    handling all the different coding styles
> (b) a main script checking the patch header and calling a code style
>    specific script for each source file modified by the patch

It seems like specific script for style checking is not needed. Because clang-format tool does style checking by itself.
All we need is just to provide appropriate coding style description file for each.
Clang-format is a bit specific tool, so we can not specify explicitly file with coding style description.
It just looks for a .clang-format file in one of a parent directories of a file being checked.
As we got at least three coding-styles we have to substitute needed file in sources top directory for each check.
It could be done by generating .clang-format file dynamically depending on style/path from the STYLES file.
Another way could be using appropriate symlink on existing .clang-format file which is located somewhere in  tools/clang-format/coding-style-file like:

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.