Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# Deliberately minimal: every key below is here because leaving it at the
# Google default (or at the value the earlier draft of this file used)
# measurably increased the diff against WLED's existing code. Options that
# already matched Google's default, or made no measurable difference, were
# left out rather than spelled out for documentation's sake.
#
# Requires clang-format 16+ (AlignTrailingComments' Kind-based syntax below
# needs it). Verified to parse cleanly on clang-format 16, 18 and 22.
BasedOnStyle: Google
ColumnLimit: 240 # WLED convention: wide lines, not the 80-col default
AlignTrailingComments: Leave # preserves existing comment-column alignment; forcing "Never" re-collapses spacing on every touched line, breaking alignment with untouched neighbours
AllowShortCaseLabelsOnASingleLine: true # matches the `case X: doThing(); break;` style used throughout
AllowShortFunctionsOnASingleLine: Inline # keeps short wrapper/getter functions on one line, closer to existing code than Google's stricter default
AllowShortIfStatementsOnASingleLine: AllIfsAndElse # un-deprecates the old "Always" value used before; matches existing single-line if/else usage
BreakConstructorInitializers: BeforeComma # non-deprecated replacement for BreakConstructorInitializersBeforeComma
InsertNewlineAtEOF: true # text files should end with a newline
KeepEmptyLinesAtTheStartOfBlocks: true # deliberately kept in its deprecated spelling: the modern nested "KeepEmptyLines" key errors out on clang-format 16 and 18, and CodeRabbit's suggested "KeepEmptyLinesAtTopOfFunctions" is an unknown key on 14/16/18/22 alike. This old alias parses cleanly on all of them.
MaxEmptyLinesToKeep: 2 # existing code frequently uses double blank lines; Google's default of 1 would touch far more of it
ReflowComments: false # don't rewrap comment text/wording
SortIncludes: Never # WLED sometimes orders includes deliberately (platform/feature guards); alphabetising risks reordering them and breaking a build
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.cache
.clang-format
.direnv
.DS_Store
.idea
Expand Down
8 changes: 8 additions & 0 deletions wled00/src/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
# This directory holds vendored third-party code (src/dependencies/*: json,
# fastled_slim, espalexa, e131, dmx, ws2812fx, etc.) and generated font data
# (src/font/*), none of which follows WLED's own style. A child .clang-format
# fully replaces the parent's config for everything below it (no merging), so
# this disables formatting entirely rather than letting the root .clang-format
# reach in and reformat upstream/generated code.
DisableFormat: true
Loading