misc: add clang-format file
This commit is contained in:
parent
64dd229a5b
commit
31417ccfcd
96
.clang-format
Normal file
96
.clang-format
Normal file
@ -0,0 +1,96 @@
|
||||
# libuv .clang-format configuration
|
||||
# Based on Google C/C++ Style Guide with libuv-specific adaptations
|
||||
|
||||
BasedOnStyle: Google
|
||||
|
||||
# Language and standard
|
||||
Language: Cpp
|
||||
|
||||
# Indentation and spacing (2 spaces, no tabs as per CONTRIBUTING.md)
|
||||
IndentWidth: 2
|
||||
TabWidth: 2
|
||||
UseTab: Never
|
||||
ContinuationIndentWidth: 4
|
||||
IndentCaseLabels: false
|
||||
|
||||
# Line length (80 characters as per CONTRIBUTING.md)
|
||||
ColumnLimit: 80
|
||||
|
||||
# Alignment and breaking
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignConsecutiveMacros: true
|
||||
AlignEscapedNewlines: Right
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllArgumentsOnNextLine: false
|
||||
AllowAllConstructorInitializersOnNextLine: false
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: None
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
|
||||
# Breaking and wrapping
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: false
|
||||
BinPackArguments: false
|
||||
BinPackParameters: false
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Attach
|
||||
Cpp11BracedListStyle: true
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakStringLiterals: true
|
||||
|
||||
# Spacing
|
||||
SpaceAfterCStyleCast: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 2
|
||||
SpacesInAngles: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
|
||||
# Pointers and references
|
||||
PointerAlignment: Left
|
||||
DerivePointerAlignment: false
|
||||
|
||||
# Comments
|
||||
ReflowComments: true
|
||||
|
||||
# Includes
|
||||
IncludeBlocks: Preserve
|
||||
SortIncludes: false
|
||||
|
||||
# Penalties for breaking (to control formatting decisions)
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 1
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 200
|
||||
|
||||
# Macros and preprocessor
|
||||
IndentPPDirectives: AfterHash
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
|
||||
# Enum and macro formatting
|
||||
AllowShortEnumsOnASingleLine: false
|
||||
SpaceBeforeSquareBrackets: false
|
||||
|
||||
# Other formatting options
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MaxEmptyLinesToKeep: 2
|
||||
FixNamespaceComments: false
|
||||
|
||||
# Function spacing: requiring 2 newlines before functions is not supported by clang-format tool automatically
|
||||
SeparateDefinitionBlocks: Leave
|
||||
@ -206,6 +206,7 @@ typedef enum {
|
||||
UV_HANDLE_TYPE_MAX
|
||||
} uv_handle_type;
|
||||
|
||||
/* clang-format off */
|
||||
typedef enum {
|
||||
UV_UNKNOWN_REQ = 0,
|
||||
#define XX(uc, lc) UV_##uc,
|
||||
@ -214,6 +215,7 @@ typedef enum {
|
||||
UV_REQ_TYPE_PRIVATE
|
||||
UV_REQ_TYPE_MAX
|
||||
} uv_req_type;
|
||||
/* clang-format on */
|
||||
|
||||
|
||||
/* Handle types. */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user