Skip to content

Commit 81fc166

Browse files
authored
Merge pull request #2760 from heeplr/code-formatting-target
add code formatting target to makefile
2 parents 4a6916a + 636f6fc commit 81fc166

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed

src/.clang-format

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
BasedOnStyle: LLVM
2+
#AccessModifierOffset: -4
3+
AlignAfterOpenBracket: BlockIndent
4+
AlignArrayOfStructures: Left
5+
#AlignConsecutiveAssignments: None
6+
#AlignConsecutiveBitFields: AcrossComments
7+
#AlignConsecutiveDeclarations: AcrossComments
8+
#AlignConsecutiveMacros: AcrossComments
9+
#AlignEscapedNewlines: Left
10+
#AlignOperands: DontAlign
11+
AlignTrailingComments: true
12+
#AllowAllArgumentsOnNextLine: false
13+
#AllowAllParametersOfDeclarationOnNextLine: false
14+
#AllowShortBlocksOnASingleLine: Always
15+
AllowShortCaseLabelsOnASingleLine: true
16+
#AllowShortEnumsOnASingleLine: true
17+
AllowShortFunctionsOnASingleLine: Inline
18+
#AllowShortIfStatementsOnASingleLine: WithoutElse
19+
#AllowShortLambdasOnASingleLine: Empty
20+
#AllowShortLoopsOnASingleLine: false
21+
#AlwaysBreakAfterReturnType: None
22+
#AlwaysBreakTemplateDeclarations: Yes
23+
BinPackArguments: false
24+
BinPackParameters: false
25+
#BraceWrapping:
26+
# AfterCaseLabel: false
27+
# AfterClass: true
28+
# AfterStruct: false
29+
# AfterControlStatement: Never
30+
# AfterEnum: true
31+
# AfterFunction: true
32+
# AfterNamespace: true
33+
# AfterUnion: true
34+
# BeforeCatch: true
35+
# BeforeElse: false
36+
# BeforeWhile: false
37+
# IndentBraces: false
38+
# SplitEmptyFunction: false
39+
# SplitEmptyRecord: true
40+
#BreakBeforeBraces: Custom
41+
BreakBeforeBinaryOperators: None
42+
#BreakBeforeTernaryOperators: true
43+
#BreakConstructorInitializers: BeforeComma
44+
#BreakInheritanceList: BeforeColon
45+
ColumnLimit: 80
46+
#CompactNamespaces: false
47+
ContinuationIndentWidth: 4
48+
#IncludeBlocks: Preserve
49+
#IndentCaseLabels: false
50+
#IndentPPDirectives: None
51+
IndentWidth: 4
52+
#InsertBraces: false
53+
#KeepEmptyLinesAtTheStartOfBlocks: true
54+
MaxEmptyLinesToKeep: 2
55+
#NamespaceIndentation: None
56+
#ObjCSpaceAfterProperty: false
57+
#ObjCSpaceBeforeProtocolList: true
58+
#PackConstructorInitializers: Never
59+
#PointerAlignment: Left
60+
ReflowComments: false
61+
SortIncludes: Never
62+
#SpaceAfterCStyleCast: false
63+
#SpaceAfterLogicalNot: false
64+
#SpaceAfterTemplateKeyword: false
65+
#SpaceBeforeAssignmentOperators: true
66+
#SpaceBeforeCpp11BracedList: true
67+
#SpaceBeforeCtorInitializerColon: true
68+
#SpaceBeforeInheritanceColon: false
69+
#SpaceBeforeParens: ControlStatements
70+
#SpaceBeforeRangeBasedForLoopColon: true
71+
#SpaceInEmptyParentheses: false
72+
#SpacesBeforeTrailingComments: 2
73+
#SpacesInAngles: false
74+
#SpacesInCStyleCastParentheses: false
75+
#SpacesInContainerLiterals: false
76+
#SpacesInParentheses: false
77+
#SpacesInSquareBrackets: false
78+
TabWidth: 4
79+
UseTab: Never

src/Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,4 +1445,16 @@ cscope:
14451445

14461446
cscopeclean:
14471447
bash -c 'for f in `find ./ -name "cscope.*out"`;do rm $$f;done'
1448+
1449+
.PHONY: format
1450+
format: format-cpp format-python
1451+
1452+
format-cpp:
1453+
$(ECHO) -n "formatting C/C++ files..."
1454+
@find -regex '.*\.\(cc\|cpp\|hpp\|cu\|c\|h\)' -exec clang-format -style=file -i "{}" \;
1455+
$(ECHO) "done"
1456+
1457+
format-python:
1458+
$(ECHO) "formatting python files..."
1459+
@black .
14481460
# vim:ts=8:sts=8:sw=8:noet:

0 commit comments

Comments
 (0)