fix(lint): retune .clang-format to this project's actual style #46

Merged
hoogv merged 0 commits from refs/pull/46/head into dev 2026-07-22 15:09:49 +00:00
hoogv commented 2026-07-22 15:07:34 +00:00 (Migrated from codeberg.org)

.clang-format (added under feat(c-lint)) turned out to be Zephyr's own config file copied verbatim -- IndentWidth: 8, UseTab: ForContinuationAndIndentation, and Zephyr-specific ForEachMacros/AttributeMacros/IncludeCategories lists that don't apply to this project at all.

Surfaced concretely while landing DMM (#44): the lint.yml clang-format job (#39) failed on the newly-added hal/registers/component/dmm.h. Running clang-format -i with the existing config produced badly mangled output -- switched to 8-space tabs and broke apart the hand-aligned CMSIS-style bitfield comment tables every register header in this project relies on for readability.

Retuned to this project's actual established conventions: 4-space indent, no tabs, brace-on-its-own-line (Allman), and ColumnLimit: 0 / ReflowComments: false since this project's register headers rely on long, single-line TRM-cross-reference doc comments that aren't meant to be wrapped. Added AlignConsecutiveBitFields/AlignConsecutiveDeclarations/AlignTrailingComments so clang-format's own alignment stays close to (though not byte-identical to) this project's manually-tuned bitfield tables.

Not byte-identical to already-landed headers (e.g. adcbuf.h) -- retroactively reformatting those is out of scope, matching lint.yml's existing changed-files-only design. Verified the tuned config produces clean, readable, internally-consistent alignment on a new header (hal/registers/component/dmm.h, from the still-open #44) instead of the tab/8-space mess the old config produced.

Closes #45

`.clang-format` (added under `feat(c-lint)`) turned out to be Zephyr's own config file copied verbatim -- `IndentWidth: 8`, `UseTab: ForContinuationAndIndentation`, and Zephyr-specific `ForEachMacros`/`AttributeMacros`/`IncludeCategories` lists that don't apply to this project at all. Surfaced concretely while landing DMM (#44): the `lint.yml` `clang-format` job (#39) failed on the newly-added `hal/registers/component/dmm.h`. Running `clang-format -i` with the existing config produced badly mangled output -- switched to 8-space tabs and broke apart the hand-aligned CMSIS-style bitfield comment tables every register header in this project relies on for readability. Retuned to this project's actual established conventions: 4-space indent, no tabs, brace-on-its-own-line (Allman), and `ColumnLimit: 0` / `ReflowComments: false` since this project's register headers rely on long, single-line TRM-cross-reference doc comments that aren't meant to be wrapped. Added `AlignConsecutiveBitFields`/`AlignConsecutiveDeclarations`/`AlignTrailingComments` so clang-format's own alignment stays close to (though not byte-identical to) this project's manually-tuned bitfield tables. Not byte-identical to already-landed headers (e.g. `adcbuf.h`) -- retroactively reformatting those is out of scope, matching `lint.yml`'s existing changed-files-only design. Verified the tuned config produces clean, readable, internally-consistent alignment on a new header (`hal/registers/component/dmm.h`, from the still-open #44) instead of the tab/8-space mess the old config produced. Closes #45
hoogv self-assigned this 2026-07-23 13:35:16 +00:00
hoogv added this to the Development project 2026-07-23 13:38:23 +00:00
Sign in to join this conversation.
No reviewers
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
opendutchsolutions.public/hal_awr6843!46
No description provided.