Re: [Tracker] Formatting code automatically with Uncrustify



Hello,

It used to be that we were as a development team quite against this, as
you could loose some of the capabilities of git-blame (which we used).

The rule we had was that we'd change formatting around the code that we
were changing. And gradually we would be changing the code-style.

However. Development is no longer as active as it used to be, and not
as many developers are simultaneously working on the sources as it used
to be, either.

So for me it's fine to run it over the sources as a single big commit.

Kind regards,

Philip


On Fri, 2019-04-19 at 14:54 +0200, Sam Thursfield via tracker-list
wrote:
Hi all,

I've been looking at whether we can automatically reformat Tracker's
source code using 'uncrustify'. This tool is already used by
Nautilus.

The motivation is that I don't like giving minor style feedback in
merge requests, I'd prefer to focus on the actual content and
functionality. But I also don't want inconsistent code formatting. So
it would be ideal if we could say 'run this tool to fix your
formatting'.

Uncrustify is very configurable. I made a configuration file for
Tracker which tries to match our current coding style[2].

The main difficulty is in variable definition alignment in functions
and structs. We're currently quite inconsitent about whether we do
this
or not, and Uncrustify doesn't have an option to ignore alignment --
either you enable it, and it reformats everything to be aligned, or
you
disable it and it reformats everything to be unaligned.

You can see the results here:

  https://gitlab.gnome.org/GNOME/tracker/merge_requests/87

This commit makes a lot of changes all over the code, but it would
mean
that we could tell future patch submitters to run
`utils/run-uncrustify.sh` to fix their formattting, rather than
expecting them to read the whole of [2].

What do you think? Are the benefits worth the cost? Is the new style
nice enough to look at?

Sam

1. https://github.com/uncrustify/uncrustify
2. https://wiki.gnome.org/Projects/Tracker/Documentation/CodingStyle

_______________________________________________
tracker-list mailing list
tracker-list gnome org
https://mail.gnome.org/mailman/listinfo/tracker-list

Attachment: signature.asc
Description: This is a digitally signed message part



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