Repository navigation
Conversation
Add scripts/check_format.sh to verify and apply clang-format formatting to src/ C++ sources, scripts/pre-push.sh as a git pre-push hook that delegates to check_format.sh --fix and runs the host-side test suite, and .githooks/pre-push as the committed copy (enabled via git config core.hooksPath .githooks). The hook aborts the push if clang-format reformats any files or if any test fails, so contributors review and commit changes before pushing.
|
|
||
| // Glucose trends | ||
| const uint8_t symbol_doubleUp[] PROGMEM = { | ||
| 0b01010000, |
There was a problem hiding this comment.
How do we preserve this? They are binary and formatted as-is to be human-readable
There was a problem hiding this comment.
you are right, I missed this.
thanks for spotting it.
I have added an "ignore" marker for the block of code that have the matrixes.
|
Hi, I am not a C/C++/embedded dev so I am not at all sure what is the best formatting. If you're a C/C++ dev, just let me know that you know what you are doing and it is not just a random formatting wish. |
Write each row of the 5x5 pixel glucose trend arrow bitmaps on its own line and guard the block with clang-format off/on so clang-format does not collapse each initializer onto a single line. The vertical layout keeps each symbol's pixel pattern human-readable while the formatted output stays identical.
Neither I am.... I simply enforced to apply the rules in .clang-format ad updated some values that were triggering errors.
|
Add a
pre-pushgit hook and acheck_format.shscript to enforce the project's C++ formatting rules (defined in.clang-format) and run the host-side test suite before every push.What changed
New files:
scripts/check_format.sh— checks (default) or fixes (--fix) allsrc/*.{cpp,h}files against.clang-formatusingclang-format --dry-run --Werror/-iscripts/pre-push.sh— pre-push hook that delegates tocheck_format.sh --fixand runstest/run_tests.shin parallel.githooks/pre-push— committed copy of the hook (enabled viagit config core.hooksPath .githooks)Modified:
.clang-format— fixed schema type errors (AllowShortIfStatementsOnASingleLine: false→Never,AlignConsecutiveAssignments: false→None, etc.) so the config loads cleanly in clang-format 23.1.5 and the VS Code YAML schemaCONTRIBUTING.md— added a "Code formatting" section documenting the check/fix commands and how to enable the pre-push hookBehavior
On
git push, the hook:scripts/check_format.sh --fix— if any.cpp/.hfile gets reformatted, the push is aborted so you can review and commit the formatting firsttest/run_tests.sh— if any test fails, the push is aborted✅ pre-push: all checks passed.Testing
clang-format --style=file --dump-configloads cleanly (exit 0, no warnings)scripts/check_format.shreports all 92src/files as correctly formatted after--fix