-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clang format #824
Clang format #824
Conversation
Memory usage change @ 51da30e
Click for full report table
Click for full report CSV
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quite a bit of changes to review here, but I guess most if it is formatting changes. Looks good from what I can see so far...
Yeah, its all white space changes and some CI upgrades. I just wanted your sign off on the style because these changes will validate a consistent code style going forward (clang-format can be rather picky). @Avamander I know we haven't heard much from you lately, but if you wanted to review before merging, let me know. I mention this because you've expressed significant interest about code style in the past. Once this is merged, I'll open similar PRs for the other nRF24 repos... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I've been a bit busy. These changes look good.
This PR is designed to enforce uniform code style using clang-format. The style rules that clang-format adheres to are defined in the .clang-format files.
While modifying the CI workflows to check code format, I added a new action that will report compile size changes when the PR is open or re-opened. The reports come in the form of thread comments (see below), and they only focus on Arduino Nano, ATTinyx5, and Arduino MKR Zero. This solves #802
There are 2 .clang-format files:
Using the cpp-linter-action
For now I have the action setup to check all source code in the repo. This could be changed to only check the the event's diff for code style violations. This decision is entirely dependent on preference and checking only the diff will yield slightly faster CI runs (like 2 or 3 seconds faster).
As of right now, the action is configured to use clang-format v12 since that was the latest stable version available via
apt
and LLVM releases at the initial creation of this branch. Note that by defaultsudo apt install clang-format
installs clang-format v10 (usesudo apt install clang-format-12
).For those of you using VSCode, there is a handy extension that formats source code using the locally installed clang-format; I used this extension to make the most of changes in this PR. There are other officially endorsed IDE integrations which are named in the LLVM docs.
Going Forward
I plan to create a repo for the nRF24 org (called .github - see github docs about org profiles)
This new repo will be the home for any files that are not specific to any particular code in the org's repos/libs, namely CONTRIBUTING.md.
I will begin writing up a code style guideline there, so that the style rules defined in the .clang-format files are explicitly explained.
Potentially, the .github repo could also contain re-usable CI workflows/actions. This is more of a long-term goal though.
In researching this further I found that only workflows that don't use a job matrix can call reusable workflows. This means that only the docs CI could be made into a reusable workflow from the .github repo.
Lastly I found and fixed a dead link in CONTRIBUTING.md to the Arduino example style guide.