Skip to content

Commit c6412b2

Browse files
authored
Simplify clang-format file (exercism#368)
* Simplify clang-format file. * Remove unnecessary header line. * Move check-formatting.sh script
1 parent 315bb38 commit c6412b2

File tree

3 files changed

+7
-170
lines changed

3 files changed

+7
-170
lines changed

.clang-format

+5-168
Original file line numberDiff line numberDiff line change
@@ -1,169 +1,6 @@
1-
---
2-
# This style is identical to Google style but with IndentWidth and ObjCBlockIndentWidth set to 4, the rest is identical
3-
Language: Cpp
4-
# BasedOnStyle: Google
5-
AccessModifierOffset: -1
6-
AlignAfterOpenBracket: Align
7-
AlignConsecutiveMacros: false
8-
AlignConsecutiveAssignments: false
9-
AlignConsecutiveDeclarations: false
10-
AlignEscapedNewlines: Left
11-
AlignOperands: true
12-
AlignTrailingComments: true
13-
AllowAllArgumentsOnNextLine: true
14-
AllowAllConstructorInitializersOnNextLine: true
15-
AllowAllParametersOfDeclarationOnNextLine: true
16-
AllowShortBlocksOnASingleLine: Never
17-
AllowShortCaseLabelsOnASingleLine: false
18-
AllowShortFunctionsOnASingleLine: All
19-
AllowShortLambdasOnASingleLine: All
20-
AllowShortIfStatementsOnASingleLine: WithoutElse
21-
AllowShortLoopsOnASingleLine: true
22-
AlwaysBreakAfterDefinitionReturnType: None
23-
AlwaysBreakAfterReturnType: None
24-
AlwaysBreakBeforeMultilineStrings: true
25-
AlwaysBreakTemplateDeclarations: Yes
26-
BinPackArguments: true
27-
BinPackParameters: true
28-
BraceWrapping:
29-
AfterCaseLabel: false
30-
AfterClass: false
31-
AfterControlStatement: false
32-
AfterEnum: false
33-
AfterFunction: false
34-
AfterNamespace: false
35-
AfterObjCDeclaration: false
36-
AfterStruct: false
37-
AfterUnion: false
38-
AfterExternBlock: false
39-
BeforeCatch: false
40-
BeforeElse: false
41-
IndentBraces: false
42-
SplitEmptyFunction: true
43-
SplitEmptyRecord: true
44-
SplitEmptyNamespace: true
45-
BreakBeforeBinaryOperators: None
46-
BreakBeforeBraces: Attach
47-
BreakBeforeInheritanceComma: false
48-
BreakInheritanceList: BeforeColon
49-
BreakBeforeTernaryOperators: true
50-
BreakConstructorInitializersBeforeComma: false
51-
BreakConstructorInitializers: BeforeColon
52-
BreakAfterJavaFieldAnnotations: false
53-
BreakStringLiterals: true
54-
ColumnLimit: 80
55-
CommentPragmas: '^ IWYU pragma:'
56-
CompactNamespaces: false
57-
ConstructorInitializerAllOnOneLineOrOnePerLine: true
58-
ConstructorInitializerIndentWidth: 4
59-
ContinuationIndentWidth: 4
60-
Cpp11BracedListStyle: true
61-
DeriveLineEnding: true
62-
DerivePointerAlignment: true
63-
DisableFormat: false
64-
ExperimentalAutoDetectBinPacking: false
65-
FixNamespaceComments: true
66-
ForEachMacros:
67-
- foreach
68-
- Q_FOREACH
69-
- BOOST_FOREACH
70-
IncludeBlocks: Regroup
71-
IncludeCategories:
72-
- Regex: '^<ext/.*\.h>'
73-
Priority: 2
74-
SortPriority: 0
75-
- Regex: '^<.*\.h>'
76-
Priority: 1
77-
SortPriority: 0
78-
- Regex: '^<.*'
79-
Priority: 2
80-
SortPriority: 0
81-
- Regex: '.*'
82-
Priority: 3
83-
SortPriority: 0
84-
IncludeIsMainRegex: '([-_](test|unittest))?$'
85-
IncludeIsMainSourceRegex: ''
86-
IndentCaseLabels: true
87-
IndentGotoLabels: true
88-
IndentPPDirectives: None
89-
IndentWidth: 4
90-
IndentWrappedFunctionNames: false
91-
JavaScriptQuotes: Leave
92-
JavaScriptWrapImports: true
93-
KeepEmptyLinesAtTheStartOfBlocks: false
94-
MacroBlockBegin: ''
95-
MacroBlockEnd: ''
96-
MaxEmptyLinesToKeep: 1
97-
NamespaceIndentation: None
98-
ObjCBinPackProtocolList: Never
99-
ObjCBlockIndentWidth: 4
100-
ObjCSpaceAfterProperty: false
101-
ObjCSpaceBeforeProtocolList: true
102-
PenaltyBreakAssignment: 2
103-
PenaltyBreakBeforeFirstCallParameter: 1
104-
PenaltyBreakComment: 300
105-
PenaltyBreakFirstLessLess: 120
106-
PenaltyBreakString: 1000
107-
PenaltyBreakTemplateDeclaration: 10
108-
PenaltyExcessCharacter: 1000000
109-
PenaltyReturnTypeOnItsOwnLine: 200
110-
PointerAlignment: Left
111-
RawStringFormats:
112-
- Language: Cpp
113-
Delimiters:
114-
- cc
115-
- CC
116-
- cpp
117-
- Cpp
118-
- CPP
119-
- 'c++'
120-
- 'C++'
121-
CanonicalDelimiter: ''
122-
BasedOnStyle: google
123-
- Language: TextProto
124-
Delimiters:
125-
- pb
126-
- PB
127-
- proto
128-
- PROTO
129-
EnclosingFunctions:
130-
- EqualsProto
131-
- EquivToProto
132-
- PARSE_PARTIAL_TEXT_PROTO
133-
- PARSE_TEST_PROTO
134-
- PARSE_TEXT_PROTO
135-
- ParseTextOrDie
136-
- ParseTextProtoOrDie
137-
CanonicalDelimiter: ''
138-
BasedOnStyle: google
139-
ReflowComments: true
140-
SortIncludes: true
141-
SortUsingDeclarations: true
142-
SpaceAfterCStyleCast: false
143-
SpaceAfterLogicalNot: false
144-
SpaceAfterTemplateKeyword: true
145-
SpaceBeforeAssignmentOperators: true
146-
SpaceBeforeCpp11BracedList: false
147-
SpaceBeforeCtorInitializerColon: true
148-
SpaceBeforeInheritanceColon: true
149-
SpaceBeforeParens: ControlStatements
150-
SpaceBeforeRangeBasedForLoopColon: true
151-
SpaceInEmptyBlock: false
152-
SpaceInEmptyParentheses: false
153-
SpacesBeforeTrailingComments: 2
154-
SpacesInAngles: false
155-
SpacesInConditionalStatement: false
156-
SpacesInContainerLiterals: true
157-
SpacesInCStyleCastParentheses: false
158-
SpacesInParentheses: false
159-
SpacesInSquareBrackets: false
160-
SpaceBeforeSquareBrackets: false
161-
Standard: Auto
162-
StatementMacros:
163-
- Q_UNUSED
164-
- QT_REQUIRE_VERSION
165-
TabWidth: 8
166-
UseCRLF: false
167-
UseTab: Never
168-
...
1+
# Base this off of Google Style
2+
BasedOnStyle: Google
1693

4+
# Customize with larger indents
5+
IndentWidth: 4
6+
ObjCBlockIndentWidth: 4

.github/workflows/verify-code-formatting.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ jobs:
2727
if: github.ref == 'refs/heads/master'
2828
run: |
2929
find . -type f \( -iname '*.cpp' -o -iname '*.h' -o -iname '*.hpp' \) -a ! -iname "catch.hpp" | \
30-
xargs ./check-formatting.sh
30+
xargs bin/check-formatting.sh
3131
3232
- name: "Verify formatting of the PR's files"
3333
if: github.ref != 'refs/heads/master' && github.event.pull_request.url
3434
run: |
3535
PULL_REQUEST_URL=$(jq -r ".pull_request.url" "$GITHUB_EVENT_PATH")
3636
curl --url $"${PULL_REQUEST_URL}/files" --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | \
3737
jq -c '.[] | select(.status == "added" or .status == "modified") | select(.filename | match("(?<!catch)\\.(cpp|hpp|h)$")) | .filename' | \
38-
xargs ./check-formatting.sh
38+
xargs bin/check-formatting.sh
File renamed without changes.

0 commit comments

Comments
 (0)