Skip to content
Merged
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
26 changes: 26 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
Language: Cpp
BasedOnStyle: LLVM

IndentWidth: 4
TabWidth: 4
UseTab: Never
ColumnLimit: 0

BreakBeforeBraces: Allman
AccessModifierOffset: -4
IndentCaseLabels: true
NamespaceIndentation: All

PointerAlignment: Right
ReferenceAlignment: Right
SpaceBeforeParens: ControlStatements
SpaceAfterCStyleCast: false

AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignTrailingComments: true

# ESP-IDF/Arduino headers are often order-sensitive (macros defined before
# a later #include changes its behavior), so don't reorder them.
SortIncludes: Never
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{cpp,h,hpp,ino}]
indent_style = space
indent_size = 4

# Markdown often uses two trailing spaces to force a line break.
[*.md]
trim_trailing_whitespace = false
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
* text=auto eol=lf

*.cpp text eol=lf
*.h text eol=lf
*.hpp text eol=lf
*.ino text eol=lf
59 changes: 59 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
name: Lint

'on':
push:
branches:
- "master"
- "ci-builds-*"
pull_request:
workflow_dispatch:

concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true

permissions: {}

jobs:
whitespace:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v7

# The codebase is still catching up (see CONTRIBUTING.md), so this
# reports issues without blocking merges.
- name: Check line endings and indentation
continue-on-error: true
run: |
echo "Checking for CRLF line endings (should be LF, see .gitattributes)..."
if grep -rl $'\r' --include='*.cpp' --include='*.h' --include='*.hpp' --include='*.ino' . | grep -v '^\./test/'; then
echo "::warning::CRLF line endings found in the file(s) listed above. Run 'git add --renormalize .' after .gitattributes is respected, or convert with dos2unix."
else
echo "None found."
fi

echo "Checking for tab characters (should be spaces, see .editorconfig)..."
if grep -rl $'\t' --include='*.cpp' --include='*.h' --include='*.hpp' --include='*.ino' . | grep -v '^\./test/'; then
echo "::warning::Tab characters found in the file(s) listed above."
else
echo "None found."
fi

clang-format:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v7

# Style is still catching up across the codebase (see CONTRIBUTING.md),
# so this check reports issues without blocking merges.
- name: Check formatting with clang-format
continue-on-error: true
run: |
find . \( -name '*.cpp' -o -name '*.h' -o -name '*.hpp' -o -name '*.ino' \) \
-not -path './test/*' \
-print0 | xargs -0 clang-format --dry-run --Werror -style=file
Loading
Loading