Commit graph

8 commits

Author SHA1 Message Date
Ondrej Holy 0865620acf Revert "uncrustify: Ignore sp_arith to workaround bug"
This reverts commit 3ad2de33da.
2021-07-14 09:35:18 +02:00
António Fernandes 3ad2de33da uncrustify: Ignore sp_arith to workaround bug
A new bug in uncrustify 0.73 causes a pointer type to be interpreted
as an arithmetic operation, thus adding a space. [0]

This causes the CI pipeline to fail on style-check job.

To workaround this, ignore the "space around arithmetic operator" rule.

[0] https://github.com/uncrustify/uncrustify/issues/3233
2021-07-11 22:05:51 +00:00
António Fernandes 885de25eeb uncrustify: Enforce single space after control flow keywords
This is the style we use, but we were missing the uncrustify
configuration for it.
2021-04-19 11:20:13 +00:00
Ondrej Holy bec3229e99 uncrustify: Group single line comments to block
C++ comments ("//") are converted to C comments ("/* */"), but they
are not grouped together. So, each line is enclosed by "/* */". Let's
add cmt_cpp_group and cmt_c_group options to ensure that the single
line comments are grouped together.
2020-04-05 16:22:26 +00:00
Ondrej Holy 787842f948 uncrustify: Fix indentation of ternary operators statements
Let's add "indent_ternary_operator = 1" to our uncrustify.cfg in order
to prevent the following unwanted change:

     list = back ? nautilus_window_slot_get_back_history (self->window_slot) :
-                  nautilus_window_slot_get_forward_history (self->window_slot);
+           nautilus_window_slot_get_forward_history (self->window_slot);
2020-04-05 16:22:26 +00:00
Ernestas Kulik 0f411dc451 uncrustify.cfg: remove superfluous semicolons
In cases where statements accidentally end with tho semicolons or where
semicolons are added needlessly (empty loop bodies), those semicolons
should be removed.
2018-02-14 11:11:17 +02:00
Carlos Soriano 0abaab1c44 general: adjust uncrustify style
https://bugzilla.gnome.org/show_bug.cgi?id=770564
2016-09-06 15:41:06 +02:00
Carlos Soriano 4cafccd828 general: add uncrustify script
The current style of nautilus is rather poor and mixes at least 3
different code styles.

Specific issues that affect the most common contributors to Nautilus
performance are:
- tabs for multiline alignment.
- mix of tabs and spaces.
- errors on no braced one liners conditionals.
- errors on non braced case statements with variable declarations.

So I would say requirements for the style is to address the previous
issues and also be a well known style. I don't want new contributors
to see a new style completely different from C books authors.

So far, I found Allman (aka BSD) style which seems the choice of most C
books authors as far as I can see on internet, and it address the
previous mentioned issues.

Since uncrustify doesn't support the aligment of parameters we do for
multiple stars "**", we also added a script made by Sebastian Wilmet
to align those.

As a matter of practicity I'm going to convert all Nautilus style to
this one, and if the next person who contributes most on Nautilus has
a different choice, please feel free to change it to whatever makes your
performance and your contributors performance the best.

https://bugzilla.gnome.org/show_bug.cgi?id=770564
2016-08-29 18:37:10 +02:00