← Back to team overview

kicad-developers team mailing list archive

How I Learned to Stop Worrying (about whitespace) and Love clang-format

 

Hi everybody!

I've been following the KiCad development for some time and I feel like
quite some time is wasted on whitespaces. Be it either when new
contributors send in reviews (I find the coding style rather hard to get
acustomed to as well, personally) or when fixing them by hand when
seeing them (To make things worse, this often happens in a single commit
together with functional changes which makes it really hard to see the
relevant bits).
All in all it feels like the code base is in a very inconsistent state.
According to the developer documentation you should use uncrustify with
the provided config to make sure the your code doesn't violate the code
style, but it seems nobody really does that since running it on the code
base yields a big diff stat.
I would like to propose using clang-format to enforce a consistent code
style and tried to put together a config which resembles the current
style as close as possible. There are a few things that can't be
achieved the way it's currently defined by the style guide. So I want to
ask whether you guys are willing to make some compromises in that
regard? Considering the benefits of not having to deal with code
formattings etc. and the time it saves I think it's well worth it.
Additionally the use of clang-format will allow the usage of all the
great clang tools for further tool-based code cleanups/improvements while
maintaining the defined code style

Opinions?

Best regards,
Marvin



Follow ups