Closed dstroy0 closed 2 years ago
added .clang-format to library, the style is not right for the examples yet. Arduino uses an artistic style to format where the closing braces are on a newline.
Examples follow Arduino IDE formatting conventions, but I would like to make the C++ extension's clang-format in vscode behave the same way for the examples.
clang-format for examples still isn't right
The Arduino CLI workflow is using the examples_formatter.conf file in your examples folder. This conf file (& the action that uses it) executes a different linter called AStyle.
Arduino IDE is moving away from AStyle because it has stopped seeing updates (including possible bug fixes). Going forward, the Arduino IDE will start using clang-format, but we won't see that until the Arduino IDE v2.0 reaches stable release.
I received a copy of the proposed Arduino IDE .clang-format file from someone on the Arduino team (with admin privileges). You can get a copy from the RF24/clang-format branch.
To actually use clang-format as a linter in your CI workflows, I helped write a Github Action that you can use like so:
- uses: shenxianpeng/cpp-linter-action@master
id: linter
with:
version: 12
extensions: ino
style: file
tidy-checks: '-*'
files-changed-only: false
thread-comments: false
verbosity: 20
- name: Linter checks failed?
if: steps.linter.outputs.checks-failed > 0
run: exit 1
If the clang-format file that you have now is copied from RF24/clang-format branch's root folder, then that file is meant only for linting the library.
Excellent, I've moved .clang-format to src/utility. I made the lib-cpp-linter workflow using shenxianpeng/cpp-linter-action@master
Examples do not follow arduino formatting conventions.