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

Re: [Xen-devel] Xen checkpatch infrastructure design

On 24/07/17 18:55, Iurii Artemenko wrote:
> 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. 

How does this work for a patch which is perfectly fine, while not
touched parts of the patched file are not? The tool should only
look at the added lines, not at those left unmodified.

>> 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.

How would it work for two files located in the same directory but of
different coding styles, both touched by the same patch?

> Another way could be using appropriate symlink on existing .clang-format
> file which is located somewhere in  tools/clang-format/coding-style-file
> like:
> tools/clang-format/xen-style
> tools/clang-format/linux-style
> tools/clang-format/xl-style


Xen-devel mailing list



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