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:
tools/clang-format/xen-style
tools/clang-format/linux-style
tools/clang-format/xl-style


Regards
Iurii
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

Reply via email to