Fork us on GitHub Follow us on Google+ Follow us on Facebook Follow us on Twitter

Opened 5 years ago

Closed 8 days ago

#554 closed enhancement (fixed)

C-style checking tool

Reported by: Jiri Svoboda Owned by: Jiri Svoboda
Priority: major Milestone: 0.7.2
Component: helenos-infrastructure Version:
Keywords: Cc:
Blocker for: Depends on:
See also:


C-style enforcement by human review is putting an increased burden on HelenOS developers. We need an automatic tool for checking the source code C-style, to cover at least the more common C-style errors.

Change History (7)

comment:1 Changed 5 years ago by Jiří Zárevúcky

We can try using to automatically reformat all files.

comment:2 Changed 5 years ago by Martin Decky

On a regular basis, I would prefer checking only to automatically reformatting. We have a few basic coding style rules, but all the finer details should be perhaps left to the humans, since it is more art than science and formalizing everything up to the last bit might just not be very helpful.

One-off automatic cleanup of non-compliant sources merged from an external branch is perfectly fine, but I would be against, for example, adding any automatic reformatting as a commit hook.

comment:3 Changed 5 years ago by Jiří Zárevúcky

I haven't examined the tool too closely yet, but I think it can easily be used for checking style by diffing original and reformatted sources. It the tool is sane enough, then it would keep the unspecified things unchanged.

comment:4 Changed 5 years ago by Vojtech Horky

I briefly tried the ClangFormat tool, but I think it does not yet provide all the functionality we need (I was trying it with current SVN revision).

What I miss the most is way to specify how to handle wrapping of long lines. I have not found a way how to specify the indentation of the next line among possible options.

If someone want to give it a try, here is the closest configuration I was able to create.

ColumnLimit: 80
UseTab: true
IndentWidth: 8
SpacesBeforeTrailingComments: 1
SpacesInCStyleCastParentheses: false
ConstructorInitializerIndentWidth: 2
AlignEscapedNewlinesLeft: false
BinPackParameters: true
AllowAllParametersOfDeclarationOnNextLine: false
SpaceAfterControlStatementKeyword: true
SpacesInParentheses: false
PointerBindsToType: false
SpaceInEmptyParentheses: false
IndentCaseLabels: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
BreakBeforeBraces: Stroustrup

comment:5 Changed 5 years ago by Jakub Jermář

Note that there is also the Unix command line tool called indent which can do similar things and it can also specify the indentation of the continuation lines.

comment:6 Changed 8 months ago by Jiri Svoboda

Owner: set to Jiri Svoboda
Status: newaccepted

comment:7 Changed 8 days ago by Jakub Jermář

Milestone: 0.7.2
Resolution: fixed
Status: acceptedclosed

This is fixed by Sycek.

Note: See TracTickets for help on using tickets.