Hi everyone,
I have some problems with synfig code style
-
The rules are not clear and seem to live mostly in developers minds. and the only way for a new contributor to learn them is by trial and error during review.
I found an old conversation about this followed by a pr, but it was never merged for some reason
. -
Manually reviewing and formatting code is painful and time consuming for both the contributor and the reviewer.
My Suggestions:
- Merge the pr so we have clear rules documented.
- Use clang-format to automate the formatting.
- Add a clang-format check to github workflows.
I have prepared a .clang-format configuration that matches the rules in the draft pr
.
Language: Cpp
Standard: Cpp11
BasedOnStyle: WebKit
UseTab: Always
IndentWidth: 4
TabWidth: 4
ColumnLimit: 80
ContinuationIndentWidth: 4
NamespaceIndentation: None
BreakBeforeBraces: WebKit
AlwaysBreakAfterReturnType: AllDefinitions
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AccessModifierOffset: 0
BreakConstructorInitializers: BeforeComma
SpaceBeforeParens: ControlStatements
PointerAlignment: Left
SpaceBeforeAssignmentOperators: true
IndentCaseLabels: true
SortIncludes: true
IndentPPDirectives: None
What do you think?