Hello, I’m trying to clean my code for my future pull request, and I’m a bit uncertain about what coding style I should use. I am aware of the guidelines in https://github.com/hydrogen-music/hydrogen/blob/master/DEVELOPERS but it is very succinct and is not even coherent by itself (it says that there should be spaces inside parenthesis and yet shows code examples without).
I like to work with the clang format tool. You give it a cpp file, and it makes the indentation and the spacing for you. I’m trying to configure it for Hydrogen, but for many cases, I have no idea which setting to use. With a complete clang-format configuration file, it could be ask of anyone making a pull request to use this tool before. Or not, but anyway I think, that defining the following points is a good thing to do if we want to maintain consistency in the project. These are the points where I have no idea I should behave when writing code, see their description on http://clang.llvm.org/docs/ClangFormatStyleOptions.html : - AccessModifierOffset: I found both use of value 0 and -4 in Hydrogen; - AlignAfterOpenBracket: this case happens rarely, maybe with DontAlign; - AllowShortCaseLabelsOnASingleLine: only seen once in all Hydrogen; - AlwaysBreakTemplateDeclarations: no templates are used in Hydrogen; - BreakBeforeBraces: inconsistent through Hydrogen; - BinPackArguments and BinPackParameters - ColumnLimit: there seem to be no limit, but is it wanted? - ConstructorInitializerIndentWidth - ContinuationIndentWidth - IndentCaseLabels: both found in Hydrogen - IndentWidth: since tab is used, the value is not very important; - KeepEmptyLinesAtTheStartOfBlocks: sometime fould, is it wanted? - MaxEmptyLinesToKeep: there a a lot of blank links in Hydrogen; - NamespaceIndentation: inconsistent though Hydrogen; - PointerAlignment: all found in Hydrogen, mainly right - SpaceBeforeParens: both Never and ControlStatements in Hydrogen; - SpacesInCStyleCastParentheses: both found; - SpacesInSquareBrackets: both found; - TabWidth: should be equal to IndentWidth; - UseTabs: always or only for indentation; I found that “alyaws” settings causes often troubles I do not know who can make the call for this choices. Maybe it is of no importance and we can all mix up these. Let me know what you think Here are the other options, for which values are either obvious or of no real importance : AlignConsecutiveAssignments: false AlignConsecutiveDeclarations: false AlignEscapedNewlinesLeft: false AlignOperands: true AlignTrailingComments: true AllowAllParametersOfDeclarationOnNextLine: true AllowShortBlocksOnASingleLine: false AllowShortFunctionsOnASingleLine: Inline AllowShortIfStatementsOnASingleLine: false AllowShortLoopsOnASingleLine: false AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: true BreakBeforeBinaryOperators: false BreakBeforeTernaryOperators: false BreakConstructorInitializersBeforeComma: false ConstructorInitializerAllOnOneLineOrOnePerLine: true Cpp11BracedListStyle: false DerivePointerAlignment: false IndentWrappedFunctionNames: true Language: Cpp SpaceAfterCStyleCast: false SpaceBeforeAssignmentOperators: true SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 1 SpacesInContainerLiterals: true SpacesInParentheses: true Standard: Cpp03 -- Sacha “Shaac” Delanoue ------------------------------------------------------------------------------ _______________________________________________ Hydrogen-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/hydrogen-devel
