I want to propose using clang-format instead of (or with) astyle code formatter due astyle seems rather dead than alive. Moreover lots of IDEs has built-in clang-format, while CLion, for example has no even pluggable support of astyle. One another argument is that clang-format works better. I've tested astyle config with different styles and seems like it's not working as strictly as clang-format. For examle it ignores (T foo) and ( T foo ), same for loops indention inside brackets, allows unaligned/aligned declarations and definitions combined and so on.
I've prepared .clang-format config file which match to current astyle as pretty as possible. I believe in that this is very useful code-quality improvements that will make further development easier and more comfortable.
Here's .clang-format config:
BasedOnStyle: Microsoft
IndentCaseLabels: true
PointerAlignment: Left
IndentWidth: 4
UseTab: Never
AlignAfterOpenBracket: BlockIndent
AlignArrayOfStructures: Left
ColumnLimit: 140
BreakBeforeTernaryOperators: true
AccessModifierOffset: -4
AlignConsecutiveBitFields: Consecutive
AlignConsecutiveAssignments: Consecutive
LambdaBodyIndentation: Signature
BreakBeforeBraces: Allman
IndentWrappedFunctionNames: false
Introduce clang-tidy necessity
One another option to improve code quality is using naming conventions described and code quality warnings in some general config file. There's tool from clang for this purpose - clang-tidy. Maybe it could be good idea to use one.
Sure, we can switch to clang-format. Just open a PR with the CI switching to that and the required fixes to address any of the issues it spots on the current codebase.
Introduce clang-format necessity
I want to propose using
clang-format
instead of (or with)astyle
code formatter dueastyle
seems rather dead than alive. Moreover lots of IDEs has built-inclang-format
, while CLion, for example has no even pluggable support ofastyle
. One another argument is that clang-format works better. I've testedastyle
config with different styles and seems like it's not working as strictly asclang-format
. For examle it ignores(T foo)
and( T foo )
, same for loops indention inside brackets, allows unaligned/aligned declarations and definitions combined and so on.I've prepared
.clang-format
config file which match to currentastyle
as pretty as possible. I believe in that this is very useful code-quality improvements that will make further development easier and more comfortable.Here's
.clang-format
config:Introduce clang-tidy necessity
One another option to improve code quality is using naming conventions described and code quality warnings in some general config file. There's tool from clang for this purpose - clang-tidy. Maybe it could be good idea to use one.
For example, naming conventions can described with readability-identifier-naming.
More about other configurations can be found here