qemu-block
[Top][All Lists]
Advanced

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

Re: cleanups with long-term benefits (was Re: [PATCH] schemas: Add vim m


From: Daniel P . Berrangé
Subject: Re: cleanups with long-term benefits (was Re: [PATCH] schemas: Add vim modeline)
Date: Fri, 31 Jul 2020 18:27:23 +0100
User-agent: Mutt/1.14.5 (2020-06-23)

On Fri, Jul 31, 2020 at 07:16:54PM +0200, Paolo Bonzini wrote:

> >>> Another example would be adopting a standard code style and using a
> >>> tool like clang-format to enforce this for entire of existing code
> >>> base and future contributions and throwing away our checkpatch.pl
> >>> which nearly everyone is scared of touching as it is Perl code.
> >> Checkpatch does much more than that, though the scary part is indeed the 
> >> one that enfoces coding style.  I wouldn't have a problem with using
> >> clang-format and calling it a day.
> > If there are things missing that we consider important, a long term
> > better strategy would be to use the Python binding to libclang to
> > detect the problem, instead of trying to parse C code with Perl and
> > regexes.
> 
> Most of it is simply "use this function instead of this one" or "place a
> comment to explain why you're using this".  The main feature of
> checkpatch.pl however is that it works on patches, not just files, but
> still there would be a substantial advantage in employing clang-format.

You say "main feature", I say "biggest flaw" ;-P

Doing checks on patches is the single worst thing about the way
we do code style validation, at it means the bulk of committed code
is never in compliance. The need to check patches is precisely because
the committed code is unclean and so can't be checked without raising
pages of problems.

Once clang-format forces the entire codebase to be in compliance then
there is (almost) no reason to check patches at all. Simply apply the
patch and check the resulting tree.  You do still want a check on the
patch to validate Signed-off-by, but that can be done as a standalone
script eg in libvirt when using GitLab CI for validating patch series,
we have this as a job:

https://gitlab.com/libvirt/libvirt-ci/-/blob/master/containers/check-dco/check-dco.py

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




reply via email to

[Prev in Thread] Current Thread [Next in Thread]