Skip to content

Commit 99a2101

Browse files
authored
Merge pull request #34 from nRF24/clang-format
Clang format
2 parents b310132 + d660bd6 commit 99a2101

File tree

38 files changed

+986
-802
lines changed

38 files changed

+986
-802
lines changed

.clang-format

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
# See options listed at https://releases.llvm.org/12.0.1/tools/clang/docs/ClangFormatStyleOptions.html
2+
---
3+
Language: Cpp
4+
# BasedOnStyle: WebKit
5+
AccessModifierOffset: -4
6+
AlignAfterOpenBracket: Align
7+
AlignConsecutiveMacros: Consecutive
8+
AlignConsecutiveAssignments: None
9+
AlignConsecutiveBitFields: None
10+
AlignConsecutiveDeclarations: None
11+
AlignEscapedNewlines: Left
12+
AlignOperands: DontAlign
13+
AlignTrailingComments: true
14+
AllowAllArgumentsOnNextLine: true
15+
AllowAllConstructorInitializersOnNextLine: true
16+
AllowAllParametersOfDeclarationOnNextLine: true
17+
AllowShortEnumsOnASingleLine: true
18+
AllowShortBlocksOnASingleLine: Always
19+
AllowShortCaseLabelsOnASingleLine: false
20+
AllowShortFunctionsOnASingleLine: All
21+
AllowShortLambdasOnASingleLine: All
22+
AllowShortIfStatementsOnASingleLine: WithoutElse
23+
AllowShortLoopsOnASingleLine: true
24+
AlwaysBreakAfterReturnType: None
25+
AlwaysBreakBeforeMultilineStrings: false
26+
AlwaysBreakTemplateDeclarations: Yes
27+
AttributeMacros: ["__capability", "__output", "__ununsed"]
28+
BinPackArguments: true
29+
BinPackParameters: true
30+
BitFieldColonSpacing: Both
31+
BraceWrapping:
32+
AfterCaseLabel: false
33+
AfterClass: true
34+
AfterControlStatement: MultiLine
35+
AfterEnum: true
36+
AfterFunction: true
37+
AfterNamespace: false
38+
AfterStruct: true
39+
AfterUnion: true
40+
AfterExternBlock: false
41+
BeforeCatch: true
42+
BeforeElse: true
43+
BeforeLambdaBody: false
44+
BeforeWhile: false
45+
IndentBraces: false
46+
SplitEmptyFunction: true
47+
SplitEmptyRecord: true
48+
SplitEmptyNamespace: true
49+
BreakBeforeBinaryOperators: All
50+
BreakBeforeConceptDeclarations: true
51+
BreakBeforeBraces: Custom
52+
BreakBeforeInheritanceComma: false
53+
BreakInheritanceList: BeforeColon
54+
BreakBeforeTernaryOperators: true
55+
BreakConstructorInitializersBeforeComma: false
56+
BreakConstructorInitializers: BeforeColon
57+
BreakStringLiterals: true
58+
ColumnLimit: 0
59+
# CommentPragmas are a regex pattern indicating the comment is not be touched by the formatter
60+
CommentPragmas: "^ Include gaurd .*"
61+
CompactNamespaces: false
62+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
63+
ConstructorInitializerIndentWidth: 4
64+
ContinuationIndentWidth: 4
65+
Cpp11BracedListStyle: true
66+
DeriveLineEnding: false
67+
DerivePointerAlignment: false
68+
DisableFormat: false
69+
EmptyLineBeforeAccessModifier: Always
70+
# ---
71+
# only in v13+
72+
# EmptyLineAfterAccessModifier: Leave
73+
# ---
74+
ExperimentalAutoDetectBinPacking: false
75+
FixNamespaceComments: true
76+
IncludeBlocks: Preserve
77+
IncludeCategories:
78+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
79+
Priority: 2
80+
SortPriority: 0
81+
CaseSensitive: false
82+
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
83+
Priority: 3
84+
SortPriority: 0
85+
CaseSensitive: false
86+
- Regex: ".*"
87+
Priority: 1
88+
SortPriority: 0
89+
CaseSensitive: false
90+
IncludeIsMainRegex: "(Test)?$"
91+
IncludeIsMainSourceRegex: ""
92+
# ---
93+
# only in v13+
94+
# IndentAccessModifiers: false
95+
# ---
96+
IndentCaseLabels: true
97+
IndentCaseBlocks: false
98+
IndentGotoLabels: false
99+
IndentPPDirectives: BeforeHash
100+
IndentExternBlock: AfterExternBlock
101+
IndentRequires: false
102+
IndentWidth: 4
103+
IndentWrappedFunctionNames: false
104+
InsertTrailingCommas: None
105+
KeepEmptyLinesAtTheStartOfBlocks: true
106+
MacroBlockBegin: ""
107+
MacroBlockEnd: ""
108+
MaxEmptyLinesToKeep: 1
109+
NamespaceIndentation: Inner
110+
PenaltyBreakAssignment: 2
111+
PenaltyBreakBeforeFirstCallParameter: 19
112+
PenaltyBreakComment: 300
113+
PenaltyBreakFirstLessLess: 120
114+
PenaltyBreakString: 1000
115+
PenaltyBreakTemplateDeclaration: 10
116+
PenaltyExcessCharacter: 1000000
117+
PenaltyReturnTypeOnItsOwnLine: 60
118+
PenaltyIndentedWhitespace: 0
119+
PointerAlignment: Left
120+
# ---
121+
# only in v13+
122+
# ReferenceAlignment: Right
123+
# ---
124+
ReflowComments: true
125+
# ---
126+
# only in v13+
127+
# ShortNamespaceLines: 0
128+
# ---
129+
# Sort**** is about sorting include/using statements alphabetically
130+
SortIncludes: false
131+
SortUsingDeclarations: false
132+
SpaceAfterCStyleCast: false
133+
SpaceAfterLogicalNot: false
134+
SpaceAfterTemplateKeyword: false
135+
SpaceBeforeAssignmentOperators: true
136+
SpaceBeforeCaseColon: false
137+
SpaceBeforeCpp11BracedList: true
138+
SpaceBeforeCtorInitializerColon: true
139+
SpaceBeforeInheritanceColon: true
140+
SpaceBeforeParens: ControlStatements
141+
SpaceAroundPointerQualifiers: Default
142+
SpaceBeforeRangeBasedForLoopColon: true
143+
SpaceInEmptyBlock: false
144+
SpaceInEmptyParentheses: false
145+
SpacesBeforeTrailingComments: 1
146+
SpacesInAngles: false
147+
SpacesInConditionalStatement: false
148+
SpacesInContainerLiterals: false
149+
SpacesInCStyleCastParentheses: false
150+
SpacesInParentheses: false
151+
SpacesInSquareBrackets: false
152+
SpaceBeforeSquareBrackets: false
153+
Standard: c++11
154+
StatementAttributeLikeMacros: [emit]
155+
StatementMacros: [Q_UNUSED, QT_REQUIRE_VERSION]
156+
TabWidth: 4
157+
UseCRLF: false
158+
UseTab: Never
159+
WhitespaceSensitiveMacros:
160+
- PRIPSTR
161+
- STRINGIZE
162+
- PP_STRINGIZE
163+
- BOOST_PP_STRINGIZE
164+
- NS_SWIFT_NAME
165+
- CF_SWIFT_NAME

.github/workflows/build_arduino.yml

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,29 @@ jobs:
2020
runs-on: ubuntu-latest
2121

2222
steps:
23-
- name: Checkout
24-
uses: actions/checkout@v2
25-
- name: Check code formatting
26-
uses: per1234/artistic-style-action@main
27-
with:
28-
options-file-path: ./examples/examples_formatter.conf
29-
name-patterns: |
30-
- '*.ino'
31-
- '*.cpp'
32-
- '*.hpp'
33-
- '*.h'
34-
target-paths: |
35-
- examples
23+
- uses: actions/checkout@v3
24+
- uses: actions/setup-python@v3
25+
# Ubuntu 20.04.4 LTS runners ship with clang-tools v12
26+
# - name: Install clang-tools
27+
# uses: KyleMayes/install-llvm-action@v1
28+
# with:
29+
# version: 12
30+
- name: Install linter python package
31+
run: python3 -m pip install git+https://github.com/cpp-linter/cpp-linter-action@v1
32+
- name: run linter as a python package
33+
id: linter
34+
run: |
35+
cpp-linter \
36+
--version=12 \
37+
--style=file \
38+
--tidy-checks='-*' \
39+
--files-changed-only='False' \
40+
--extensions=ino,cpp,h \
41+
--ignore='utility|clock-arch.c|clock-arch.h|Dns.cpp|Dns.h'
42+
- name: Linter checks failed?
43+
if: steps.linter.outputs.checks-failed > 0
44+
run: exit 1
45+
3646
build:
3747
needs: check_formatting
3848
runs-on: ubuntu-latest

.github/workflows/build_platformIO.yml

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,28 @@ jobs:
6161
runs-on: ubuntu-latest
6262

6363
steps:
64-
- name: Checkout
65-
uses: actions/checkout@v2
66-
- name: Check code formatting
67-
uses: per1234/artistic-style-action@main
68-
with:
69-
options-file-path: ./examples/examples_formatter.conf
70-
name-patterns: |
71-
- '*.ino'
72-
- '*.cpp'
73-
- '*.hpp'
74-
- '*.h'
75-
target-paths: |
76-
- examples
64+
- uses: actions/checkout@v3
65+
- uses: actions/setup-python@v3
66+
# Ubuntu 20.04.4 LTS runners ship with clang-tools v12
67+
# - name: Install clang-tools
68+
# uses: KyleMayes/install-llvm-action@v1
69+
# with:
70+
# version: 12
71+
- name: Install linter python package
72+
run: python3 -m pip install git+https://github.com/cpp-linter/cpp-linter-action@v1
73+
- name: run linter as a python package
74+
id: linter
75+
run: |
76+
cpp-linter \
77+
--version=12 \
78+
--style=file \
79+
--tidy-checks='-*' \
80+
--files-changed-only='False' \
81+
--extensions=ino,cpp,h \
82+
--ignore='utility|clock-arch.c|clock-arch.h|Dns.cpp|Dns.h'
83+
- name: Linter checks failed?
84+
if: steps.linter.outputs.checks-failed > 0
85+
run: exit 1
7786

7887
build:
7988
needs: [check_formatting, validate_lib_json]

.github/workflows/doxygen.yml

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,31 @@ jobs:
3333
runs-on: ubuntu-latest
3434

3535
steps:
36-
- uses: actions/checkout@v2
37-
- name: get latest release version number
38-
id: latest_ver
39-
run: echo "::set-output name=release::$(awk -F "=" '/version/ {print $2}' library.properties)"
40-
- name: overwrite doxygen tags
41-
run: |
42-
touch doxygenAction
43-
echo "PROJECT_NUMBER = ${{ steps.latest_ver.outputs.release }}" >> doxygenAction
44-
echo "@INCLUDE = doxygenAction" >> Doxyfile
45-
- name: build doxygen
46-
uses: mattnotmitt/doxygen-action@v1
47-
with:
48-
working-directory: '.'
49-
doxyfile-path: './Doxyfile'
50-
- name: upload to github pages
51-
if: ${{ github.event_name == 'release'}}
52-
uses: peaceiris/actions-gh-pages@v3
53-
with:
54-
github_token: ${{ secrets.GITHUB_TOKEN }}
55-
publish_dir: ./docs/html
36+
- uses: actions/checkout@v2
37+
- name: get latest release version number
38+
id: latest_ver
39+
run: echo "::set-output name=release::$(awk -F "=" '/version/ {print $2}' library.properties)"
40+
- name: overwrite doxygen tags
41+
run: |
42+
touch doxygenAction
43+
echo "PROJECT_NUMBER = ${{ steps.latest_ver.outputs.release }}" >> doxygenAction
44+
echo "@INCLUDE = doxygenAction" >> Doxyfile
45+
- name: install Doxygen static libclang deps
46+
run: sudo apt-get install libclang1-9 libclang-cpp9
47+
- name: install doxygen from SF binary archives
48+
env:
49+
DOXYGEN_VERSION: '1.9.4'
50+
run: |
51+
mkdir doxygen && cd doxygen
52+
curl -L https://sourceforge.net/projects/doxygen/files/rel-$DOXYGEN_VERSION/doxygen-$DOXYGEN_VERSION.linux.bin.tar.gz > doxygen.tar.gz
53+
gunzip doxygen.tar.gz
54+
tar xf doxygen.tar
55+
cd doxygen-$DOXYGEN_VERSION
56+
sudo make install
57+
- run: doxygen
58+
- name: upload to github pages
59+
if: ${{ github.event_name == 'release'}}
60+
uses: peaceiris/actions-gh-pages@v3
61+
with:
62+
github_token: ${{ secrets.GITHUB_TOKEN }}
63+
publish_dir: ./docs/html

0 commit comments

Comments
 (0)