Skip to content

Commit e02438f

Browse files
committed
Add clang format and clang tidy
1 parent ca52ecf commit e02438f

File tree

2 files changed

+109
-0
lines changed

2 files changed

+109
-0
lines changed

.clang-format

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
BasedOnStyle: Mozilla
2+
3+
AccessModifierOffset: '-4'
4+
AlignAfterOpenBracket: BlockIndent
5+
AlignEscapedNewlines: Left
6+
AllowAllArgumentsOnNextLine: false
7+
AllowAllParametersOfDeclarationOnNextLine: false
8+
AllowShortBlocksOnASingleLine: false
9+
AllowShortCaseLabelsOnASingleLine: false
10+
AllowShortFunctionsOnASingleLine: false
11+
AllowShortIfStatementsOnASingleLine: false
12+
# Forbid one line lambdas because clang-format makes a weird split when
13+
# single instructions lambdas are too long.
14+
AllowShortLambdasOnASingleLine: Empty
15+
AllowShortLoopsOnASingleLine: false
16+
AlwaysBreakAfterDefinitionReturnType: None
17+
AlwaysBreakAfterReturnType: None
18+
AlwaysBreakTemplateDeclarations: Yes
19+
BinPackArguments: false
20+
BinPackParameters: false
21+
BreakBeforeBinaryOperators: NonAssignment
22+
BreakBeforeBraces: Allman
23+
BreakBeforeTernaryOperators: true
24+
BreakConstructorInitializers: BeforeComma
25+
BreakInheritanceList: AfterComma
26+
BreakStringLiterals: false
27+
ColumnLimit: '110'
28+
ConstructorInitializerIndentWidth: '4'
29+
ContinuationIndentWidth: '4'
30+
Cpp11BracedListStyle: true
31+
DerivePointerAlignment: false
32+
DisableFormat: false
33+
EmptyLineAfterAccessModifier: Always
34+
EmptyLineBeforeAccessModifier: Always
35+
ExperimentalAutoDetectBinPacking: true
36+
IncludeBlocks: Regroup
37+
IncludeCategories:
38+
- Regex: <[^.]+>
39+
Priority: 1
40+
- Regex: <sparrow/.+>
41+
Priority: 3
42+
- Regex: <.+>
43+
Priority: 2
44+
- Regex: '"sparrow/.+"'
45+
Priority: 4
46+
- Regex: '".+"'
47+
Priority: 5
48+
IndentCaseLabels: true
49+
IndentPPDirectives: AfterHash
50+
IndentWidth: '4'
51+
IndentWrappedFunctionNames: false
52+
InsertBraces: true
53+
InsertTrailingCommas: Wrapped
54+
KeepEmptyLinesAtTheStartOfBlocks: false
55+
LambdaBodyIndentation: Signature
56+
Language: Cpp
57+
MaxEmptyLinesToKeep: '2'
58+
NamespaceIndentation: All
59+
ObjCBlockIndentWidth: '4'
60+
ObjCSpaceAfterProperty: false
61+
ObjCSpaceBeforeProtocolList: false
62+
PackConstructorInitializers: Never
63+
PenaltyBreakAssignment: 100000
64+
PenaltyBreakBeforeFirstCallParameter: 0
65+
PenaltyBreakComment: 10
66+
PenaltyBreakOpenParenthesis: 0
67+
PenaltyBreakTemplateDeclaration: 0
68+
PenaltyExcessCharacter: 10
69+
PenaltyIndentedWhitespace: 0
70+
PenaltyReturnTypeOnItsOwnLine: 10
71+
PointerAlignment: Left
72+
QualifierAlignment: Custom # Experimental
73+
QualifierOrder: [inline, static, constexpr, const, volatile, type]
74+
ReflowComments: true
75+
SeparateDefinitionBlocks: Always
76+
SortIncludes: CaseInsensitive
77+
SortUsingDeclarations: true
78+
SpaceAfterCStyleCast: true
79+
SpaceAfterTemplateKeyword: true
80+
SpaceBeforeAssignmentOperators: true
81+
SpaceBeforeParens: ControlStatements
82+
SpaceInEmptyParentheses: false
83+
SpacesBeforeTrailingComments: '2'
84+
SpacesInAngles: false
85+
SpacesInCStyleCastParentheses: false
86+
SpacesInContainerLiterals: false
87+
SpacesInParentheses: false
88+
SpacesInSquareBrackets: false
89+
Standard: c++20
90+
TabWidth: '4'
91+
UseTab: Never

.clang-tidy

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
Checks: 'clang-diagnostic-*,clang-analyzer-*,cppcoreguidelines-*,modernize-*,performance-*,portability-*,-modernize-use-trailing-return-type'
3+
WarningsAsErrors: ''
4+
HeaderFileExtensions:
5+
- ''
6+
- h
7+
- hh
8+
- hpp
9+
- hxx
10+
ImplementationFileExtensions:
11+
- c
12+
- cc
13+
- cpp
14+
- cxx
15+
HeaderFilterRegex: ''
16+
FormatStyle: file
17+
SystemHeaders: false
18+
...

0 commit comments

Comments
 (0)