Skip to content

Commit b174d37

Browse files
authored
Add a format checking job and clang-format config (#93)
* Add a format checking job and clang-format config * Run `ci/clang-format.sh --fix` * Revert some formatting * Ignore some other files * Use `cmp -s` instead of `diff` * Format xqd.h, as it's manually maintained
1 parent a25ab11 commit b174d37

File tree

10 files changed

+6421
-6140
lines changed

10 files changed

+6421
-6140
lines changed

.clang-format

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: LLVM
4+
AccessModifierOffset: -2
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveMacros: false
7+
AlignConsecutiveAssignments: false
8+
AlignConsecutiveBitFields: false
9+
AlignConsecutiveDeclarations: false
10+
AlignEscapedNewlines: Right
11+
AlignOperands: Align
12+
AlignTrailingComments: true
13+
AllowAllArgumentsOnNextLine: true
14+
AllowAllConstructorInitializersOnNextLine: true
15+
AllowAllParametersOfDeclarationOnNextLine: true
16+
AllowShortEnumsOnASingleLine: true
17+
AllowShortBlocksOnASingleLine: Never
18+
AllowShortCaseLabelsOnASingleLine: false
19+
AllowShortFunctionsOnASingleLine: All
20+
AllowShortLambdasOnASingleLine: All
21+
AllowShortIfStatementsOnASingleLine: Never
22+
AllowShortLoopsOnASingleLine: false
23+
AlwaysBreakAfterDefinitionReturnType: None
24+
AlwaysBreakAfterReturnType: None
25+
AlwaysBreakBeforeMultilineStrings: false
26+
AlwaysBreakTemplateDeclarations: MultiLine
27+
BinPackArguments: true
28+
BinPackParameters: true
29+
BraceWrapping:
30+
AfterCaseLabel: false
31+
AfterClass: false
32+
AfterControlStatement: Never
33+
AfterEnum: false
34+
AfterFunction: false
35+
AfterNamespace: false
36+
AfterObjCDeclaration: false
37+
AfterStruct: false
38+
AfterUnion: false
39+
AfterExternBlock: false
40+
BeforeCatch: false
41+
BeforeElse: false
42+
BeforeLambdaBody: false
43+
BeforeWhile: false
44+
IndentBraces: false
45+
SplitEmptyFunction: true
46+
SplitEmptyRecord: true
47+
SplitEmptyNamespace: true
48+
BreakBeforeBinaryOperators: None
49+
BreakBeforeBraces: Attach
50+
BreakBeforeInheritanceComma: false
51+
BreakInheritanceList: BeforeColon
52+
BreakBeforeTernaryOperators: true
53+
BreakConstructorInitializersBeforeComma: false
54+
BreakConstructorInitializers: BeforeColon
55+
BreakAfterJavaFieldAnnotations: false
56+
BreakStringLiterals: true
57+
ColumnLimit: 100
58+
CommentPragmas: '^ IWYU pragma:'
59+
CompactNamespaces: false
60+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
61+
ConstructorInitializerIndentWidth: 4
62+
ContinuationIndentWidth: 4
63+
Cpp11BracedListStyle: true
64+
DeriveLineEnding: true
65+
DerivePointerAlignment: false
66+
DisableFormat: false
67+
ExperimentalAutoDetectBinPacking: false
68+
FixNamespaceComments: true
69+
ForEachMacros:
70+
- foreach
71+
- Q_FOREACH
72+
- BOOST_FOREACH
73+
IncludeBlocks: Preserve
74+
IncludeCategories:
75+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
76+
Priority: 2
77+
SortPriority: 0
78+
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
79+
Priority: 3
80+
SortPriority: 0
81+
- Regex: '.*'
82+
Priority: 1
83+
SortPriority: 0
84+
IncludeIsMainRegex: '(Test)?$'
85+
IncludeIsMainSourceRegex: ''
86+
IndentCaseLabels: false
87+
IndentCaseBlocks: false
88+
IndentGotoLabels: true
89+
IndentPPDirectives: None
90+
IndentExternBlock: AfterExternBlock
91+
IndentWidth: 2
92+
IndentWrappedFunctionNames: false
93+
InsertTrailingCommas: None
94+
JavaScriptQuotes: Leave
95+
JavaScriptWrapImports: true
96+
KeepEmptyLinesAtTheStartOfBlocks: true
97+
MacroBlockBegin: ''
98+
MacroBlockEnd: ''
99+
MaxEmptyLinesToKeep: 1
100+
NamespaceIndentation: None
101+
ObjCBinPackProtocolList: Auto
102+
ObjCBlockIndentWidth: 2
103+
ObjCBreakBeforeNestedBlockParam: true
104+
ObjCSpaceAfterProperty: false
105+
ObjCSpaceBeforeProtocolList: true
106+
PenaltyBreakAssignment: 2
107+
PenaltyBreakBeforeFirstCallParameter: 19
108+
PenaltyBreakComment: 300
109+
PenaltyBreakFirstLessLess: 120
110+
PenaltyBreakString: 1000
111+
PenaltyBreakTemplateDeclaration: 10
112+
PenaltyExcessCharacter: 1000000
113+
PenaltyReturnTypeOnItsOwnLine: 60
114+
PointerAlignment: Right
115+
ReflowComments: true
116+
SortIncludes: true
117+
SortUsingDeclarations: true
118+
SpaceAfterCStyleCast: false
119+
SpaceAfterLogicalNot: false
120+
SpaceAfterTemplateKeyword: true
121+
SpaceBeforeAssignmentOperators: true
122+
SpaceBeforeCpp11BracedList: false
123+
SpaceBeforeCtorInitializerColon: true
124+
SpaceBeforeInheritanceColon: true
125+
SpaceBeforeParens: ControlStatements
126+
SpaceBeforeRangeBasedForLoopColon: true
127+
SpaceInEmptyBlock: false
128+
SpaceInEmptyParentheses: false
129+
SpacesBeforeTrailingComments: 1
130+
SpacesInAngles: false
131+
SpacesInConditionalStatement: false
132+
SpacesInContainerLiterals: true
133+
SpacesInCStyleCastParentheses: false
134+
SpacesInParentheses: false
135+
SpacesInSquareBrackets: false
136+
SpaceBeforeSquareBrackets: false
137+
Standard: Latest
138+
StatementMacros:
139+
- Q_UNUSED
140+
- QT_REQUIRE_VERSION
141+
TabWidth: 8
142+
UseCRLF: false
143+
UseTab: Never
144+
WhitespaceSensitiveMacros:
145+
- STRINGIZE
146+
- PP_STRINGIZE
147+
- BOOST_PP_STRINGIZE
148+
...
149+

.github/workflows/main.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,3 +330,11 @@ jobs:
330330

331331
- name: Run shellcheck
332332
run: ci/shellcheck.sh
333+
334+
format:
335+
runs-on: ubuntu-latest
336+
steps:
337+
- uses: actions/checkout@v2
338+
- run: |
339+
clang-format --version
340+
ci/clang-format.sh

c-dependencies/js-compute-runtime/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ compile_commands.json:
8484
echo ']' \
8585
) > "$@"
8686

87+
format: $(FSM_CPP)
88+
$(ROOT_SRC)/../ci/clang-format.sh --fix
89+
8790
# Useful for debugging, try `make print-FSM_CPP`
8891
print-%:
8992
$Q echo "$($*)"

0 commit comments

Comments
 (0)