From e0d390c5c463a1d225bbd74f24f883091188add1 Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Tue, 20 Feb 2024 05:00:11 -0800 Subject: [PATCH] Update clang format (#231) * satisfy nRF24/.github#9 * ran clang-format * use separate CI workflow to check code format * enable dependabot --- .clang-format | 23 ++++------- .github/dependabot.yml | 13 +++++++ .github/workflows/build_arduino.yml | 9 +---- .github/workflows/build_linux.yml | 8 +--- .github/workflows/build_platformIO.yml | 10 ++--- .github/workflows/build_rp2xxx.yml | 8 +--- .github/workflows/clang_format.yml | 14 +++++++ .github/workflows/doxygen.yml | 4 +- RF24Mesh.h | 8 ++-- .../ncurses/RF24Mesh_Ncurses_Master.cpp | 38 +++++++++---------- 10 files changed, 68 insertions(+), 67 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/clang_format.yml diff --git a/.clang-format b/.clang-format index 5b8681e..f403b24 100644 --- a/.clang-format +++ b/.clang-format @@ -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 @@ -89,10 +86,7 @@ IncludeCategories: CaseSensitive: false IncludeIsMainRegex: "(Test)?$" IncludeIsMainSourceRegex: "" -# --- -# only in v13+ -# IndentAccessModifiers: false -# --- +IndentAccessModifiers: false IndentCaseLabels: true IndentCaseBlocks: false IndentGotoLabels: false @@ -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 diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..05a48fc --- /dev/null +++ b/.github/dependabot.yml @@ -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" diff --git a/.github/workflows/build_arduino.yml b/.github/workflows/build_arduino.yml index 2b675bf..039877c 100644 --- a/.github/workflows/build_arduino.yml +++ b/.github/workflows/build_arduino.yml @@ -2,25 +2,20 @@ name: Arduino CLI build on: pull_request: - types: [opened, reopened] + branches: [master, v1.x] paths: - ".github/workflows/build_arduino.yml" - "examples/**" push: + branches: [master, v1.x] paths: - ".github/workflows/build_arduino.yml" - "examples/**" jobs: - check_formatting: - uses: nRF24/.github/.github/workflows/cpp_lint.yaml@main - with: - ignore: '!examples|' - extensions: ino build: - needs: check_formatting uses: nRF24/.github/.github/workflows/build_arduino.yaml@main with: sketch-paths: | diff --git a/.github/workflows/build_linux.yml b/.github/workflows/build_linux.yml index aa0c40f..2cf2e51 100644 --- a/.github/workflows/build_linux.yml +++ b/.github/workflows/build_linux.yml @@ -2,7 +2,7 @@ name: Linux build on: pull_request: - types: [opened, reopened] + branches: [master, v1.x] paths: - "*.h" - "*.cpp" @@ -15,6 +15,7 @@ on: - "pyRF24Mesh/*" - ".github/workflows/build_linux.yml" push: + branches: [master, v1.x] paths: - "*.h" - "*.cpp" @@ -34,13 +35,8 @@ env: BUILD_TYPE: Release jobs: - check_formatting: - uses: nRF24/.github/.github/workflows/cpp_lint.yaml@main - with: - ignore: 'examples|examples_pico' using_cmake: - needs: check_formatting uses: nRF24/.github/.github/workflows/build_linux_cmake.yaml@main with: rf24mesh-ref: ${{ github.sha }} diff --git a/.github/workflows/build_platformIO.yml b/.github/workflows/build_platformIO.yml index d63af5a..13ad585 100644 --- a/.github/workflows/build_platformIO.yml +++ b/.github/workflows/build_platformIO.yml @@ -2,7 +2,7 @@ name: PlatformIO build on: pull_request: - types: [opened, reopened] + branches: [master, v1.x] paths: - ".github/workflows/build_platformIO.yml" - "library.json" @@ -10,6 +10,7 @@ on: - "!examples/old_backups/**" - "!examples/rf24_ATTiny/**" push: + branches: [master, v1.x] paths: - ".github/workflows/build_platformIO.yml" - "library.json" @@ -26,13 +27,8 @@ jobs: with: deploy-release: ${{ github.event_name == 'release' }} - check_formatting: - uses: nRF24/.github/.github/workflows/cpp_lint.yaml@main - with: - extensions: ino - build: - needs: [check_formatting, validate_lib_json] + needs: [validate_lib_json] uses: nRF24/.github/.github/workflows/build_platformio.yaml@main with: example-path: ${{ matrix.example }} diff --git a/.github/workflows/build_rp2xxx.yml b/.github/workflows/build_rp2xxx.yml index f6ae05a..0ec5fdf 100644 --- a/.github/workflows/build_rp2xxx.yml +++ b/.github/workflows/build_rp2xxx.yml @@ -2,6 +2,7 @@ name: Pico SDK build on: push: + branches: [master, v1.x] paths: - ".github/workflows/build_rp2xxx.yml" - "*.h" @@ -10,7 +11,7 @@ on: - "cmake/" - "examples_pico/*" pull_request: - types: [opened, reopened] + branches: [master, v1.x] paths: - ".github/workflows/build_rp2xxx.yml" - "*.h" @@ -20,13 +21,8 @@ on: - "examples_pico/*" jobs: - check_formatting: - uses: nRF24/.github/.github/workflows/cpp_lint.yaml@main - with: - ignore: '!examples_pico|' build: - needs: check_formatting uses: nRF24/.github/.github/workflows/build_pico_sdk.yaml@main with: board-id: ${{ matrix.board }} diff --git a/.github/workflows/clang_format.yml b/.github/workflows/clang_format.yml new file mode 100644 index 0000000..41105c1 --- /dev/null +++ b/.github/workflows/clang_format.yml @@ -0,0 +1,14 @@ +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 + with: + ignore: examples/old_backups|utility/RPi/bcm2835.h|utility/RPi/bcm2835.c + extensions: ino,c,cpp,h diff --git a/.github/workflows/doxygen.yml b/.github/workflows/doxygen.yml index a81874e..502802e 100644 --- a/.github/workflows/doxygen.yml +++ b/.github/workflows/doxygen.yml @@ -2,7 +2,7 @@ name: build Docs on: pull_request: - types: [opened, reopened] + branches: [master, v1.x] paths: - "*.h" - "docs/**" @@ -15,6 +15,7 @@ on: - "Doxyfile" - "library.properties" # get lib version from here push: + branches: [master, v1.x] paths: - "*.h" - "docs/**" @@ -27,7 +28,6 @@ on: - "Doxyfile" - "library.properties" # get lib version from here release: - branches: [master] types: [published, edited] workflow_dispatch: diff --git a/RF24Mesh.h b/RF24Mesh.h index 1df1305..a1223ea 100644 --- a/RF24Mesh.h +++ b/RF24Mesh.h @@ -80,7 +80,7 @@ class ESBMesh public: /** * Construct the mesh. - * + * * v2.0 supports a backward compatible constructor: * @code * RF24 radio(7, 8); @@ -91,7 +91,7 @@ class ESBMesh * RF52Network network1(radio1); * RF52Mesh mesh1(network1, radio1); // for nRF52xxx family * @endcode - * + * * @see v2.0 supports [nrf_to_nrf Arduino library](https://github.com/TMRh20/nrf_to_nrf) * for nrf52 chips' internal radio. * @param _radio The underlying radio driver instance @@ -371,11 +371,11 @@ class ESBMesh /** * A type definition of the template class `ESBMesh` to maintain backward compatibility. - * + * * ```.cpp * RF24 radio(7, 8); * RF24Network network(radio); - * + * * RF24Mesh mesh(radio, network); * // is equivalent to * ESBMesh, RF24> mesh(radio, network); diff --git a/examples_RPi/ncurses/RF24Mesh_Ncurses_Master.cpp b/examples_RPi/ncurses/RF24Mesh_Ncurses_Master.cpp index 921cc88..34e2852 100644 --- a/examples_RPi/ncurses/RF24Mesh_Ncurses_Master.cpp +++ b/examples_RPi/ncurses/RF24Mesh_Ncurses_Master.cpp @@ -1,24 +1,24 @@ /* -* RF24Mesh Master Node Monitoring Tool -* This is a generic tool for master nodes running RF24Mesh that will display address -* assignments, and information regarding incoming data, regardless of the specific -* configuration details. -* -* Requirements: NCurses -* Install NCurses: apt-get install libncurses5-dev -* Setup: -* 1: make -* 2: sudo ./RF24Mesh_Ncurses_Master -* -* NOTE: DEBUG MUST BE DISABLED IN RF24Mesh_config.h -* -* Once configured and running, the interface will display the header information, data rate, -* and address assignments for all connected nodes.* -* The master node will also continuously ping each of the child nodes, one per second, while indicating -* the results. -* -*/ + * RF24Mesh Master Node Monitoring Tool + * This is a generic tool for master nodes running RF24Mesh that will display address + * assignments, and information regarding incoming data, regardless of the specific + * configuration details. + * + * Requirements: NCurses + * Install NCurses: apt-get install libncurses5-dev + * Setup: + * 1: make + * 2: sudo ./RF24Mesh_Ncurses_Master + * + * NOTE: DEBUG MUST BE DISABLED IN RF24Mesh_config.h + * + * Once configured and running, the interface will display the header information, data rate, + * and address assignments for all connected nodes.* + * The master node will also continuously ping each of the child nodes, one per second, while indicating + * the results. + * + */ #include #include "RF24Mesh/RF24Mesh.h"