-
-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
editorconfig.org #332
base: master
Are you sure you want to change the base?
editorconfig.org #332
Conversation
Having consistent coding styles makes perfect sense! Therefore I would suggest |
It was mentioned that some tooling to help enforce/automate style would be more preferred: i.e. https://clang.llvm.org/docs/ClangFormat.html |
Taking some notes about the style I'm seeing in some prominent files, focusing on
|
This is what I've come up with so far, using
This also bases around using tab characters for indentation, with an assumed width of 8 characters. This starts to matter when using e.g. # https://clang.llvm.org/docs/ClangFormatStyleOptions.html
---
#DisableFormat: true
Language: Cpp
Standard: Latest
#Standard: Auto
AccessModifierOffset: -8
AlignAfterOpenBracket: BlockIndent
#AlignAfterOpenBracket: AlwaysBreak
#AlignAfterOpenBracket: DontAlign
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseExpressionOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: false
#AllowShortFunctionsOnASingleLine: None
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Inline
#AllowShortLambdasOnASingleLine: All
#AllowShortLambdasOnASingleLine: Empty
BinPackArguments: false
BinPackParameters: OnePerLine #clang-format v20
#BinPackParameters: false
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakBeforeBraces: Custom
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeComma
#ColumnLimit: 0
ColumnLimit: 160
#ColumnLimit: 10000
CompactNamespaces: false
ConstructorInitializerIndentWidth: 8
ContinuationIndentWidth: 8
DerivePointerAlignment: false
FixNamespaceComments: true
IndentCaseBlocks: false
IndentCaseLabels: true
IndentExternBlock: NoIndent
IndentGotoLabels: false
IndentWidth: 8
NamespaceIndentation: None
PackConstructorInitializers: Never
#PackConstructorInitializers: CurrentLine #https://github.com/llvm/llvm-project/issues/61938
PointerAlignment: Middle
PPIndentWidth: 0
QualifierAlignment: Right
#ReflowComments: true
SeparateDefinitionBlocks: Always
ShortNamespaceLines: 0
SortIncludes: Never
#SortIncludes: CaseSensitive
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
#SpaceAroundPointerQualifiers:
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
#SpaceBeforeParens: Custom
#SpaceBeforeParensOptions:
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
#SpaceInEmptyBlock: true
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParens: Never
#SpacesInParens: Custom
#SpacesInParensOptions:
# ExceptDoubleParentheses: false
# InConditionalStatements: false
# InCStyleCasts: false
# InEmptyParentheses: false
# Other: false
SpacesInSquareBrackets: false
TabWidth: 8
UseTab: Always |
https://editorconfig.org/
EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs. The EditorConfig project consists of a file format for defining coding styles and a collection of text editor plugins that enable editors to read the file format and adhere to defined styles. EditorConfig files are easily readable and they work nicely with version control systems.