Skip to content

Commit 97a2c73

Browse files
authored
Update clang format (#41)
* satisfy nRF24/.github#9 * ran clang-format * use separate workflow to check code format * enable dependabot
1 parent c9cedef commit 97a2c73

7 files changed

+58
-50
lines changed

.clang-format

+12-21
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ AlignTrailingComments: true
1414
AllowAllArgumentsOnNextLine: true
1515
AllowAllConstructorInitializersOnNextLine: true
1616
AllowAllParametersOfDeclarationOnNextLine: true
17-
AllowShortEnumsOnASingleLine: true
18-
AllowShortBlocksOnASingleLine: Always
19-
AllowShortCaseLabelsOnASingleLine: false
17+
AllowShortEnumsOnASingleLine: false
18+
AllowShortBlocksOnASingleLine: Empty
19+
AllowShortCaseLabelsOnASingleLine: true
2020
AllowShortFunctionsOnASingleLine: All
2121
AllowShortLambdasOnASingleLine: All
22-
AllowShortIfStatementsOnASingleLine: WithoutElse
23-
AllowShortLoopsOnASingleLine: true
22+
AllowShortIfStatementsOnASingleLine: Never
23+
AllowShortLoopsOnASingleLine: false
2424
AlwaysBreakAfterReturnType: None
2525
AlwaysBreakBeforeMultilineStrings: false
2626
AlwaysBreakTemplateDeclarations: Yes
@@ -67,10 +67,7 @@ DeriveLineEnding: false
6767
DerivePointerAlignment: false
6868
DisableFormat: false
6969
EmptyLineBeforeAccessModifier: Always
70-
# ---
71-
# only in v13+
72-
# EmptyLineAfterAccessModifier: Leave
73-
# ---
70+
EmptyLineAfterAccessModifier: Leave
7471
ExperimentalAutoDetectBinPacking: false
7572
FixNamespaceComments: true
7673
IncludeBlocks: Preserve
@@ -89,10 +86,7 @@ IncludeCategories:
8986
CaseSensitive: false
9087
IncludeIsMainRegex: "(Test)?$"
9188
IncludeIsMainSourceRegex: ""
92-
# ---
93-
# only in v13+
94-
# IndentAccessModifiers: false
95-
# ---
89+
IndentAccessModifiers: false
9690
IndentCaseLabels: true
9791
IndentCaseBlocks: false
9892
IndentGotoLabels: false
@@ -117,15 +111,12 @@ PenaltyExcessCharacter: 1000000
117111
PenaltyReturnTypeOnItsOwnLine: 60
118112
PenaltyIndentedWhitespace: 0
119113
PointerAlignment: Left
120-
# ---
121-
# only in v13+
122-
# ReferenceAlignment: Right
123-
# ---
114+
ReferenceAlignment: Pointer
124115
ReflowComments: true
125-
# ---
126-
# only in v13+
127-
# ShortNamespaceLines: 0
128-
# ---
116+
SpacesInLineCommentPrefix:
117+
Maximum: -1
118+
Minimum: 0
119+
ShortNamespaceLines: 0
129120
# Sort**** is about sorting include/using statements alphabetically
130121
SortIncludes: false
131122
SortUsingDeclarations: false

.github/dependabot.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "github-actions"
9+
# Workflow files stored in the
10+
# default location of `.github/workflows`
11+
directory: "/"
12+
schedule:
13+
interval: "weekly"

.github/workflows/build_arduino.yml

+2-7
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,20 @@ name: Arduino CLI build
22

33
on:
44
pull_request:
5-
types: [opened, reopened]
5+
branches: [master]
66
paths:
77
- ".github/workflows/build_arduino.yml"
88
- "examples/**"
99

1010
push:
11+
branches: [master]
1112
paths:
1213
- ".github/workflows/build_arduino.yml"
1314
- "examples/**"
1415

1516
jobs:
16-
check_formatting:
17-
uses: nRF24/.github/.github/workflows/cpp_lint.yaml@main
18-
with:
19-
ignore: 'utility|clock-arch.c|clock-arch.h|Dns.cpp|Dns.h'
20-
extensions: ino,cpp,h
2117

2218
build:
23-
needs: check_formatting
2419
uses: nRF24/.github/.github/workflows/build_arduino.yaml@main
2520
with:
2621
sketch-paths: |

.github/workflows/build_platformIO.yml

+3-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: PlatformIO build
22

33
on:
44
pull_request:
5-
types: [opened, reopened]
5+
branches: [master]
66
paths:
77
- ".github/workflows/build_platformIO.yml"
88
- "library.json"
@@ -12,6 +12,7 @@ on:
1212
- "!Dns.*"
1313
- "!clock-arch.*"
1414
push:
15+
branches: [master]
1516
paths:
1617
- ".github/workflows/build_platformIO.yml"
1718
- "library.json"
@@ -30,14 +31,8 @@ jobs:
3031
with:
3132
deploy-release: ${{ github.event_name == 'release' }}
3233

33-
check_formatting:
34-
uses: nRF24/.github/.github/workflows/cpp_lint.yaml@main
35-
with:
36-
ignore: 'utility|clock-arch.c|clock-arch.h|Dns.cpp|Dns.h'
37-
extensions: ino,cpp,h
38-
3934
build:
40-
needs: [check_formatting, validate_lib_json]
35+
needs: [validate_lib_json]
4136
if:
4237
uses: nRF24/.github/.github/workflows/build_platformio.yaml@main
4338
with:

.github/workflows/clang_format.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: check code formatting
2+
3+
on:
4+
push:
5+
branches: [master, v1.x]
6+
pull_request:
7+
branches: [master, v1.x]
8+
9+
jobs:
10+
check_formatting:
11+
uses: nRF24/.github/.github/workflows/cpp_lint.yaml@main
12+
with:
13+
ignore: 'utility|clock-arch.c|clock-arch.h|Dns.cpp|Dns.h'
14+
extensions: ino,c,cpp,h

.github/workflows/doxygen.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: DoxyGen build
22

33
on:
44
pull_request:
5-
types: [opened, reopened]
5+
branches: [master]
66
paths:
77
- "*.h"
88
- "docs/**"
@@ -14,6 +14,7 @@ on:
1414
- "Doxyfile"
1515
- "library.properties" # get lib version from here
1616
push:
17+
branches: [master]
1718
paths:
1819
- "*.h"
1920
- "docs/**"
@@ -25,7 +26,6 @@ on:
2526
- "Doxyfile"
2627
- "library.properties" # get lib version from here
2728
release:
28-
branches: [master]
2929
types: [published, edited]
3030
workflow_dispatch:
3131

RF24Client.cpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -352,24 +352,24 @@ void serialip_appcall(void)
352352
// Only call this if the TCP window has already been re-opened, the connection is being polled, but no data
353353
// has been acked
354354
if (!(u->state & (UIP_CLIENT_CLOSE | UIP_CLIENT_REMOTECLOSED)))
355-
{
356-
357-
if (u->windowOpened == true && u->state & UIP_CLIENT_RESTART && millis() - u->restartTime > u->restartInterval)
358355
{
359-
u->restartTime = millis();
356+
357+
if (u->windowOpened == true && u->state & UIP_CLIENT_RESTART && millis() - u->restartTime > u->restartInterval)
358+
{
359+
u->restartTime = millis();
360360
#if defined RF24ETHERNET_DEBUG_CLIENT || defined ETH_DEBUG_L1
361-
Serial.println();
362-
Serial.print(millis());
361+
Serial.println();
362+
Serial.print(millis());
363363
#if UIP_CONNECTION_TIMEOUT > 0
364-
Serial.print(F(" UIPClient Re-Open TCP Window, time remaining before abort: "));
365-
Serial.println(UIP_CONNECTION_TIMEOUT - (millis() - u->connectTimer));
364+
Serial.print(F(" UIPClient Re-Open TCP Window, time remaining before abort: "));
365+
Serial.println(UIP_CONNECTION_TIMEOUT - (millis() - u->connectTimer));
366366
#endif
367367
#endif
368-
u->restartInterval += 500;
369-
u->restartInterval = rf24_min(u->restartInterval, 7000);
370-
uip_restart();
368+
u->restartInterval += 500;
369+
u->restartInterval = rf24_min(u->restartInterval, 7000);
370+
uip_restart();
371+
}
371372
}
372-
}
373373
}
374374

375375
/*******Close**********/

0 commit comments

Comments
 (0)