Skip to content
This repository was archived by the owner on Jan 7, 2025. It is now read-only.

Commit f34c6cc

Browse files
author
Joseph Finnegan
committed
apply clang formatter
1 parent f40129f commit f34c6cc

File tree

3 files changed

+91
-6
lines changed

3 files changed

+91
-6
lines changed

.clang-format

Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,64 @@
11
---
22
BasedOnStyle: WebKit
3-
ColumnLimit: '120'
4-
# IndentWidth: '4'
5-
# TabWidth: '4'
6-
# UseTab: Always
3+
AlignAfterOpenBracket: Align
4+
AlignConsecutiveMacros: 'true'
5+
AlignConsecutiveAssignments: 'true'
6+
AlignConsecutiveDeclarations: 'false'
7+
AlignEscapedNewlines: Left
8+
AlignOperands: 'true'
9+
AlignTrailingComments: 'true'
10+
AllowAllArgumentsOnNextLine: 'true'
11+
AllowAllConstructorInitializersOnNextLine: 'true'
12+
AllowAllParametersOfDeclarationOnNextLine: 'true'
13+
AllowShortBlocksOnASingleLine: 'true'
14+
AllowShortCaseLabelsOnASingleLine: 'false'
15+
AllowShortFunctionsOnASingleLine: All
16+
AllowShortIfStatementsOnASingleLine: Never
17+
AllowShortLambdasOnASingleLine: None
18+
AllowShortLoopsOnASingleLine: 'false'
19+
AlwaysBreakAfterReturnType: None
20+
AlwaysBreakBeforeMultilineStrings: 'false'
21+
AlwaysBreakTemplateDeclarations: 'No'
22+
BinPackArguments: 'true'
23+
BinPackParameters: 'true'
24+
BreakAfterJavaFieldAnnotations: 'true'
25+
BreakBeforeBinaryOperators: NonAssignment
26+
BreakBeforeBraces: Allman
27+
BreakBeforeTernaryOperators: 'true'
28+
BreakConstructorInitializers: AfterColon
29+
BreakInheritanceList: AfterColon
30+
ColumnLimit: '150'
31+
CompactNamespaces: 'false'
32+
ConstructorInitializerAllOnOneLineOrOnePerLine: 'false'
33+
Cpp11BracedListStyle: 'false'
34+
DerivePointerAlignment: 'false'
35+
DisableFormat: 'false'
36+
FixNamespaceComments: 'false'
37+
IncludeBlocks: Preserve
38+
IndentCaseLabels: 'true'
39+
IndentPPDirectives: BeforeHash
40+
IndentWidth: '4'
41+
IndentWrappedFunctionNames: 'true'
42+
KeepEmptyLinesAtTheStartOfBlocks: 'false'
43+
Language: Cpp
44+
MaxEmptyLinesToKeep: '1'
45+
PointerAlignment: Left
46+
ReflowComments: 'true'
47+
SortIncludes: 'true'
48+
SpaceAfterCStyleCast: 'false'
49+
SpaceAfterLogicalNot: 'false'
50+
SpaceAfterTemplateKeyword: 'false'
51+
SpaceBeforeAssignmentOperators: 'true'
52+
SpaceBeforeCpp11BracedList: 'false'
53+
SpaceBeforeCtorInitializerColon: 'false'
54+
SpaceBeforeParens: Never
55+
SpaceBeforeRangeBasedForLoopColon: 'false'
56+
SpaceInEmptyParentheses: 'false'
57+
SpacesInAngles: 'false'
58+
SpacesInCStyleCastParentheses: 'false'
59+
SpacesInParentheses: 'false'
60+
SpacesInSquareBrackets: 'false'
61+
TabWidth: '4'
62+
UseTab: Never
763

864
...

.github/workflows/github-ci.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,21 @@ jobs:
113113
name: test-results
114114
path: Sub-IoT-testsuite/report.xml
115115

116-
117-
116+
check-clang-format:
117+
name: Check CLang format
118+
runs-on: ubuntu-latest
119+
120+
steps:
121+
- uses: actions/checkout@v3
122+
123+
- name: Apply formatter
124+
run: |
125+
./clang-format-patch.sh
126+
if [[ -f clang_format.patch ]]; then exit 1; fi
127+
128+
- name: Upload patch
129+
uses: actions/upload-artifact@v2
130+
if: failure()
131+
with:
132+
name: patch
133+
path: clang_format.patch

clang-format-patch.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
find . -type d \( -path ./stack/cmake -o -path ./stack/framework/hal \) -prune -o -iname *.h -o -iname *.c | xargs clang-format-10 -style=file -i -fallback-style=none
4+
5+
git diff > clang_format.patch
6+
7+
# Delete if 0 size
8+
if [ ! -s clang_format.patch ]
9+
then
10+
rm clang_format.patch
11+
fi
12+
13+
exit 0

0 commit comments

Comments
 (0)