Skip to content

Commit

Permalink
Update clang format (#30)
Browse files Browse the repository at this point in the history
* satisfy nRF24/.github#9
* ran clang-format
* use a separate workflow to check code format
* enable dependabot
  • Loading branch information
2bndy5 authored Feb 20, 2024
1 parent 8f58e13 commit b4eb4c6
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 65 deletions.
31 changes: 11 additions & 20 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Always
AllowShortEnumsOnASingleLine: false
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLoopsOnASingleLine: true
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
Expand Down Expand Up @@ -67,10 +67,7 @@ DeriveLineEnding: false
DerivePointerAlignment: false
DisableFormat: false
EmptyLineBeforeAccessModifier: Always
# ---
# only in v13+
# EmptyLineAfterAccessModifier: Leave
# ---
EmptyLineAfterAccessModifier: Leave
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
IncludeBlocks: Preserve
Expand All @@ -89,10 +86,7 @@ IncludeCategories:
CaseSensitive: false
IncludeIsMainRegex: "(Test)?$"
IncludeIsMainSourceRegex: ""
# ---
# only in v13+
# IndentAccessModifiers: false
# ---
IndentAccessModifiers: false
IndentCaseLabels: true
IndentCaseBlocks: false
IndentGotoLabels: false
Expand All @@ -117,15 +111,12 @@ PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PenaltyIndentedWhitespace: 0
PointerAlignment: Left
# ---
# only in v13+
# ReferenceAlignment: Right
# ---
ReferenceAlignment: Pointer
ReflowComments: true
# ---
# only in v13+
# ShortNamespaceLines: 0
# ---
SpacesInLineCommentPrefix:
Maximum: -1
Minimum: 0
ShortNamespaceLines: 0
# Sort**** is about sorting include/using statements alphabetically
SortIncludes: false
SortUsingDeclarations: false
Expand Down
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions"
# Workflow files stored in the
# default location of `.github/workflows`
directory: "/"
schedule:
interval: "weekly"
6 changes: 2 additions & 4 deletions .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Linux build

on:
pull_request:
types: [opened, reopened]
branches: [master, v1.x]
paths:
- "*.h"
- "*.cpp"
Expand All @@ -12,6 +12,7 @@ on:
- "!**Makefile" # old build system is not tested in this workflow
- ".github/workflows/build_linux.yml"
push:
branches: [master, v1.x]
paths:
- "*.h"
- "*.cpp"
Expand All @@ -28,11 +29,8 @@ env:
BUILD_TYPE: Release

jobs:
check_formatting:
uses: nRF24/.github/.github/workflows/cpp_lint.yaml@main

using_cmake:
needs: check_formatting
uses: nRF24/.github/.github/workflows/build_linux_cmake.yaml@main
with:
compiler: ${{ matrix.toolchain.compiler }}
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/clang_format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: check code formatting

on:
push:
branches: [master, v1.x]
pull_request:
branches: [master, v1.x]

jobs:
check_formatting:
uses: nRF24/.github/.github/workflows/cpp_lint.yaml@main
4 changes: 2 additions & 2 deletions .github/workflows/doxygen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: build Docs

on:
pull_request:
types: [opened, reopened]
branches: [master, v1.x]
paths:
- "*.h"
- "*.md"
Expand All @@ -12,6 +12,7 @@ on:
- ".github/workflows/doxygen.yml"
- "Doxyfile"
push:
branches: [master, v1.x]
paths:
- "*.h"
- "*.md"
Expand All @@ -21,7 +22,6 @@ on:
- ".github/workflows/doxygen.yml"
- "Doxyfile"
release:
branches: [master]
types: [published, edited]
workflow_dispatch:

Expand Down
4 changes: 2 additions & 2 deletions RF24Gateway.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@ class ESBGateway

/**
* A type definition of the template class `ESBGateway` to maintain backward compatibility.
*
*
* ```.cpp
* RF24 radio(7, 8);
* RF24Network network(radio);
* RF24Mesh mesh(radio, network);
*
*
* RF24Gateway gateway(radio, network, mesh);
* // is equivalent to
* ESBGateway<ESBMesh<ESBNetwork<RF24>, RF24>, ESBNetwork<RF24>, RF24> gateway(radio, network, mesh);
Expand Down
40 changes: 20 additions & 20 deletions examples/ncurses/RF24Gateway_ncurses.cpp
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/**
* RF24Gateway NCurses interface - TMRh20 2015
* This is a generic tool for nodes supporting or combining with RF24Ethernet and/or RF24Network.
*
* The tool provides a simple interface for monitoring information and activity regarding the RF24Gateway: <br>
* a: Interface statistics from /proc/net/dev <br>
* b: RF24Mesh address/id assignments <br>
* c: RF24Network/Radio information <br>
* d: Active IP connections (optional) <br>
*
* **Requirements: NCurses**
* Install NCurses: apt-get install libncurses5-dev
*
* **Controls**
* Type 'h' to view the help menu
*
*
*/
* RF24Gateway NCurses interface - TMRh20 2015
* This is a generic tool for nodes supporting or combining with RF24Ethernet and/or RF24Network.
*
* The tool provides a simple interface for monitoring information and activity regarding the RF24Gateway: <br>
* a: Interface statistics from /proc/net/dev <br>
* b: RF24Mesh address/id assignments <br>
* c: RF24Network/Radio information <br>
* d: Active IP connections (optional) <br>
*
* **Requirements: NCurses**
* Install NCurses: apt-get install libncurses5-dev
*
* **Controls**
* Type 'h' to view the help menu
*
*
*/

#include <RF24/RF24.h>
#include <RF24Network/RF24Network.h>
Expand Down Expand Up @@ -141,9 +141,9 @@ int main()
{

/**
* The gateway handles all IP traffic (marked as EXTERNAL_DATA_TYPE) and passes it to the associated network interface
* RF24Network user payloads are loaded into the user cache
*/
* The gateway handles all IP traffic (marked as EXTERNAL_DATA_TYPE) and passes it to the associated network interface
* RF24Network user payloads are loaded into the user cache
*/

if (millis() - mesh_timer > 30000 && mesh.getNodeID())
{ //Every 30 seconds, test mesh connectivity
Expand Down
34 changes: 17 additions & 17 deletions examples/ncursesInt/RF24Gateway_ncursesInt.cpp
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/**
* RF24Gateway NCurses interface - TMRh20 2015-2022
* This is a generic tool for nodes supporting or combining with RF24Ethernet and/or RF24Network.
*
* The tool provides a simple interface for monitoring information and activity regarding the RF24Gateway: <br>
* a: Interface statistics from /proc/net/dev <br>
* b: RF24Mesh address/id assignments <br>
* c: RF24Network/Radio information <br>
* d: Active IP connections (optional) <br>
*
* **Requirements: NCurses**
* Install NCurses: apt-get install libncurses5-dev
*
* **Controls**
* Type 'h' to view the help menu
*
*
*/
* RF24Gateway NCurses interface - TMRh20 2015-2022
* This is a generic tool for nodes supporting or combining with RF24Ethernet and/or RF24Network.
*
* The tool provides a simple interface for monitoring information and activity regarding the RF24Gateway: <br>
* a: Interface statistics from /proc/net/dev <br>
* b: RF24Mesh address/id assignments <br>
* c: RF24Network/Radio information <br>
* d: Active IP connections (optional) <br>
*
* **Requirements: NCurses**
* Install NCurses: apt-get install libncurses5-dev
*
* **Controls**
* Type 'h' to view the help menu
*
*
*/

#include <RF24/RF24.h>
#include <RF24Network/RF24Network.h>
Expand Down

0 comments on commit b4eb4c6

Please sign in to comment.