Uncrustify: Difference between revisions

From Libreswan
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
(One intermediate revision by one other user not shown)
Line 18: Line 18:




How should parameters be alligned?  In declarations?  In calls?
How should parameters be aligned?  In declarations?  In calls?


- Below and inside open paren?  Requires tabs followed by spaces (requires extra care when editing).  Kernel style.  Although uncrustify seems to be off by one column.
* Below and inside open parent?  Requires tabs followed by spaces (requires extra care when editing).  Kernel style.  Although uncrustify seems to be off by one column.


- One tab in?  In declarations, this is same as body indentation, confusing?
* One tab in?  In declarations, this is same as body indentation, confusing?


Leave empty lines between cases, but don't force any.
Leave empty lines between cases, but don't force any.
Line 29: Line 29:


Non-scalar initializers are problematic.  Formatting isn't idempotent.  There isn't an obvious rule for algorithmic layout.
Non-scalar initializers are problematic.  Formatting isn't idempotent.  There isn't an obvious rule for algorithmic layout.
libreswan 3.4 is the release where we ran uncrustify. The configurations and instructions used are in docs/uncrustify/

Latest revision as of 12:30, 5 June 2013

Cleaning up the formatting is a good idea.

Doing it on a "flag day" is necessary.

It will create a break in history -- we need to mitigate this.

The process should be idempotent so we can regularly re-apply it.

The process should be incorporated into the makefiles so it is reliably reproduceable.

It is imaginable that it be done with some git hooks so only pretty code is checked in.

Linux kernel style should be the baseline. Some modifications might be worthwhile.

Hugh thinks that it is a mistake to remove all redundant braces. Sometimes they add clarity.

Formatting tables legibly is an art and may not be handled well by a program.


How should parameters be aligned? In declarations? In calls?

  • Below and inside open parent? Requires tabs followed by spaces (requires extra care when editing). Kernel style. Although uncrustify seems to be off by one column.
  • One tab in? In declarations, this is same as body indentation, confusing?

Leave empty lines between cases, but don't force any.

Brace at end of if(...), even if multiline.

Non-scalar initializers are problematic. Formatting isn't idempotent. There isn't an obvious rule for algorithmic layout.


libreswan 3.4 is the release where we ran uncrustify. The configurations and instructions used are in docs/uncrustify/