[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How about using clang-format instead checkpatch for fixing style?
From: |
Daniel P . Berrangé |
Subject: |
Re: How about using clang-format instead checkpatch for fixing style? |
Date: |
Fri, 9 Oct 2020 14:38:40 +0100 |
User-agent: |
Mutt/1.14.6 (2020-07-11) |
On Fri, Oct 09, 2020 at 03:25:04PM +0200, Paolo Bonzini wrote:
> On 09/10/20 15:02, 罗勇刚(Yonggang Luo) wrote:
> > We can even using clang-format to format the whole repository.
>
> checkpatch does other checks than formatting.
>
> Reformatting the whole repository has been mentioned many times, people
> were worried of messing up the result of "git blame". But without doing
> that, it's hard to get rid of checkpatch because checkpatch only looks
> at the lines that are touched by the patch.
It is a no-win situation.
checkpatch.pl is code that makes people run away screaming in horror,
because who really wants to look at Perl code that tries to parse C
code with regexes. The fact that you can submit a patch and get
complaints about things you didn't actually change is a poor experiance,
especially for new contributors who will wonder what they did wrong.
Certain subsystem maintainers have done bulk cleanups for pieces of
code before, most notably culling tabs. So we have taken the pain
a little before. I presume we'll continue to periodically clean
code.
Aside from the git blame pain, there will also be a period of time
when cherry-picking patches back to old versions will be tediously
conflicting, potentially forcing cherr-picking of the style cleanup
patches too. If the cleanup patches are fine grained it might not
be too terrible though.
So we have pain with current state and we have pain with use of
clang-format. The difference is the current pain is long term
ongoing pain, while the clang-format pain will be an initial
hit whose impact will slowly fade over time.
Personally I think it would be worth the change in the long
term. I should really put my money where my mouth is though and
propose it for libvirt too.
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 :|