[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] Xen checkpatch infrastructure design
On the Xen Developer Summit 2017 in Budapest we agreed to add a script to the Xen repository capable to test patches for style correctness, similar to checkpatch.pl of the Linux kernel. This is a first draft of the interface visible to users and developers. Problem to solve ---------------- Reviewing patches is requiring much bandwidth especially for maintainers of some core components of Xen. Often enough patches are not even following coding style of the modified component(s) resulting in the need to invest more time on the maintainer's side to request style related patch modifications. In order to reduce the effort spent on such pure mechanical issues of patches an interface for testing patches regarding style correctness is introduced. This script (similar to "checkpatch.pl" of the Linux kernel) will be usable by patch authors and reviewers to check for style errors. Unfortunately there is no single coding style in Xen. Depending on the source file one of several coding styles might apply: - Xen hypervisor style - Linux kernel style - libxl style - other styles? But even e.g. in the hypervisor some files are subject to the Linux kernel style as they are derived from Linux and might need patches from there, which should be easy to apply. Specification of Coding Style ----------------------------- As one patch might touch files with different code styles a single script is required being capable to test each touched file according to its style. This in turn requires a data base for defining the coding style of each source file. 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: style path where style specifies a coding style type (e.g. "linux", "xen", "libxl") and path specifies a path in the repository to which the style applies. A path can be either a directory or a file. When a directory is given all files in this directory (including any sub-directories) are of the specified coding style. It is possible to have multiple matching entries for a specific file, e.g.: xen ./xen linux ./xen/common/radix-tree.c In this case the most specific match will be used for determining the style type. Empty lines and lines starting with "#" in the STYLES file are being ignored by the patch checker. RFC: Design Considerations -------------------------- 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 I believe (b) would be easier to maintain and to develop (we could start with the main script and add style specific scripts later). Juergen _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |