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

Commit 7d61f97

Browse files
author
Joseph Finnegan
committed
apply clang formatter
1 parent 2d104de commit 7d61f97

File tree

3 files changed

+92
-4
lines changed

3 files changed

+92
-4
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: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,25 @@ jobs:
4646
if ! grep -q 'Input was decoded successfully' "results_fec.txt"; then exit 1; fi
4747
if ! grep -q 'All FIFO tests passed!' "results_fifo.txt"; then exit 1; fi
4848
49+
check-clang-format:
50+
name: Check CLang format
51+
runs-on: ubuntu-latest
52+
53+
steps:
54+
- uses: actions/checkout@v3
55+
56+
- name: Apply formatter
57+
run: |
58+
./clang-format-patch.sh
59+
if [[ -f clang_format.patch ]]; then exit 1; fi
60+
61+
- name: Upload patch
62+
uses: actions/upload-artifact@v2
63+
if: failure()
64+
with:
65+
name: patch
66+
path: clang_format.patch
67+
4968
run-testsuite:
5069
name: Run Testsuite
5170
runs-on: self-hosted

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)