All of lore.kernel.org
 help / color / mirror / Atom feed
* Xen checkpatch infrastructure design
@ 2017-07-24  8:50 Juergen Gross
  2017-07-24 11:44 ` Lars Kurth
  0 siblings, 1 reply; 9+ messages in thread
From: Juergen Gross @ 2017-07-24  8:50 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Ian Jackson, Wei Liu, Jan Beulich, Lars Kurth

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@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-07-26 16:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-24  8:50 Xen checkpatch infrastructure design Juergen Gross
2017-07-24 11:44 ` Lars Kurth
2017-07-24 12:46   ` Andrii Anisov
2017-07-24 16:55     ` Iurii Artemenko
2017-07-24 17:35       ` Lars Kurth
2017-07-26 16:08         ` Iurii Artemenko
2017-07-26 16:50           ` Lars Kurth
2017-07-24 18:08       ` Juergen Gross
2017-07-26 15:36         ` Iurii Artemenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.