[systemd-devel] clang-format: auto-formatting the code base of systemd

Umut Tezduyar Lindskog umut at tezduyar.com
Tue Jan 8 10:13:37 UTC 2019


On Sun, Jan 6, 2019 at 5:52 PM Lennart Poettering
<lennart at poettering.net> wrote:
>
> On Fr, 04.01.19 14:23, Sebastian Jennen (sebastian.jennen at gmx.de) wrote:
>
> > Hello systemd team,
> >
> > there is a pull request currently on systemd, which adds a .clang-format
> > support, which you can find here:
> > https://github.com/systemd/systemd/pull/11308
> >
> > clang-format is an automatic formatter for C code maintained by the llvm
> > project. It works by tokenizing the source code and reassembling it under
> > consideration of a single source code style defining file (.clang-format).
> >
> > I would like to ask you to participate on a poll on this, as this topic is
> > controversial.
> > One the hand this:
> > - enables programmers to auto-format their patches to comply with the
> > systemd style
> > - fixes a couple of minor code inconsistencies
> > on the other hand this:
> > - reformats all existing code, which requires review
> > - break some systemd specific styles which would need be changed some way
> > (see especially the formatting of table blocks in pull request)
> > - may annoy some developers, as custom styling is lost
> >
> > Please also take into consideration the suggested file tools/format-file.py
> > to extend the clang-format formatting.
>
> I think the core devs mostly already commented on the github issue,
> and all agree that this a good thing, and we should try to make the
> automatic reformatting a core part of our workflow. (For example, I
> think in the long run the CI should refuse PRs which are not properly
> formatted)

It can also run as a git hook before passing the commit to a CI agent.

Umut

>
> The only sticking points are some issues with the generated output
> right now, i.e. the table corruption and things like that, but let's
> discuss that on the github issue.
>
> Lennart
>
> --
> Lennart Poettering, Red Hat
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list