Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d41a2f4

Browse files
workflows: Add clang format check workflow.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
1 parent 9ca4074 commit d41a2f4

File tree

2 files changed

+183
-0
lines changed

2 files changed

+183
-0
lines changed

‎.clang-format‎

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
#
3+
# Note: The list of ForEachMacros can be obtained using:
4+
#
5+
# git grep -h '^#define [^[:space:]]*FOR_EACH[^[:space:]]*(' include/ \
6+
# | sed "s,^#define \([^[:space:]]*FOR_EACH[^[:space:]]*\)(.*,ドル - '1円'," \
7+
# | sort | uniq
8+
#
9+
# References:
10+
# - https://clang.llvm.org/docs/ClangFormatStyleOptions.html
11+
12+
---
13+
BasedOnStyle: LLVM
14+
AlignOperands: Align
15+
BreakBeforeTernaryOperators: false
16+
EmptyLineBeforeAccessModifier: LogicalBlock
17+
AlignConsecutiveMacros: AcrossComments
18+
AllowShortBlocksOnASingleLine: Never
19+
AllowShortCaseLabelsOnASingleLine: false
20+
AllowShortEnumsOnASingleLine: false
21+
AllowShortFunctionsOnASingleLine: None
22+
AllowShortIfStatementsOnASingleLine: false
23+
AllowShortLoopsOnASingleLine: false
24+
AttributeMacros:
25+
- __aligned
26+
- __deprecated
27+
- __packed
28+
- __printf_like
29+
- __syscall
30+
- __syscall_always_inline
31+
- __subsystem
32+
BitFieldColonSpacing: After
33+
BreakBeforeBraces: Attach
34+
ColumnLimit: 100
35+
ConstructorInitializerIndentWidth: 4
36+
ContinuationIndentWidth: 4
37+
ForEachMacros:
38+
- 'ARRAY_FOR_EACH'
39+
- 'ARRAY_FOR_EACH_PTR'
40+
- 'FOR_EACH'
41+
- 'FOR_EACH_FIXED_ARG'
42+
- 'FOR_EACH_IDX'
43+
- 'FOR_EACH_IDX_FIXED_ARG'
44+
- 'FOR_EACH_NONEMPTY_TERM'
45+
- 'FOR_EACH_FIXED_ARG_NONEMPTY_TERM'
46+
- 'RB_FOR_EACH'
47+
- 'RB_FOR_EACH_CONTAINER'
48+
- 'SYS_DLIST_FOR_EACH_CONTAINER'
49+
- 'SYS_DLIST_FOR_EACH_CONTAINER_SAFE'
50+
- 'SYS_DLIST_FOR_EACH_NODE'
51+
- 'SYS_DLIST_FOR_EACH_NODE_SAFE'
52+
- 'SYS_SEM_LOCK'
53+
- 'SYS_SFLIST_FOR_EACH_CONTAINER'
54+
- 'SYS_SFLIST_FOR_EACH_CONTAINER_SAFE'
55+
- 'SYS_SFLIST_FOR_EACH_NODE'
56+
- 'SYS_SFLIST_FOR_EACH_NODE_SAFE'
57+
- 'SYS_SLIST_FOR_EACH_CONTAINER'
58+
- 'SYS_SLIST_FOR_EACH_CONTAINER_SAFE'
59+
- 'SYS_SLIST_FOR_EACH_NODE'
60+
- 'SYS_SLIST_FOR_EACH_NODE_SAFE'
61+
- '_WAIT_Q_FOR_EACH'
62+
- 'Z_FOR_EACH'
63+
- 'Z_FOR_EACH_ENGINE'
64+
- 'Z_FOR_EACH_EXEC'
65+
- 'Z_FOR_EACH_FIXED_ARG'
66+
- 'Z_FOR_EACH_FIXED_ARG_EXEC'
67+
- 'Z_FOR_EACH_IDX'
68+
- 'Z_FOR_EACH_IDX_EXEC'
69+
- 'Z_FOR_EACH_IDX_FIXED_ARG'
70+
- 'Z_FOR_EACH_IDX_FIXED_ARG_EXEC'
71+
- 'Z_GENLIST_FOR_EACH_CONTAINER'
72+
- 'Z_GENLIST_FOR_EACH_CONTAINER_SAFE'
73+
- 'Z_GENLIST_FOR_EACH_NODE'
74+
- 'Z_GENLIST_FOR_EACH_NODE_SAFE'
75+
- 'STRUCT_SECTION_FOREACH'
76+
- 'STRUCT_SECTION_FOREACH_ALTERNATE'
77+
- 'TYPE_SECTION_FOREACH'
78+
- 'K_SPINLOCK'
79+
- 'COAP_RESOURCE_FOREACH'
80+
- 'COAP_SERVICE_FOREACH'
81+
- 'COAP_SERVICE_FOREACH_RESOURCE'
82+
- 'HTTP_RESOURCE_FOREACH'
83+
- 'HTTP_SERVER_CONTENT_TYPE_FOREACH'
84+
- 'HTTP_SERVICE_FOREACH'
85+
- 'HTTP_SERVICE_FOREACH_RESOURCE'
86+
- 'I3C_BUS_FOR_EACH_I3CDEV'
87+
- 'I3C_BUS_FOR_EACH_I2CDEV'
88+
- 'MIN_HEAP_FOREACH'
89+
IfMacros:
90+
- 'CHECKIF'
91+
IncludeCategories:
92+
- Regex: '^".*\.h"$'
93+
Priority: 0
94+
- Regex: '^<(assert|complex|ctype|errno|fenv|float|inttypes|limits|locale|math|setjmp|signal|stdarg|stdbool|stddef|stdint|stdio|stdlib|string|tgmath|time|wchar|wctype)\.h>$'
95+
Priority: 1
96+
- Regex: '^\<zephyr/.*\.h\>$'
97+
Priority: 2
98+
- Regex: '.*'
99+
Priority: 3
100+
IndentCaseLabels: false
101+
IndentGotoLabels: true
102+
IndentAccessModifiers: false
103+
AccessModifierOffset: -4
104+
IndentWidth: 4
105+
InsertBraces: true
106+
InsertNewlineAtEOF: true
107+
SpaceBeforeInheritanceColon: true
108+
SpaceBeforeParens: ControlStatements
109+
SortIncludes: Never
110+
SeparateDefinitionBlocks: Always
111+
UseTab: ForContinuationAndIndentation
112+
TabWidth: 4
113+
WhitespaceSensitiveMacros:
114+
- COND_CODE_0
115+
- COND_CODE_1
116+
- IF_DISABLED
117+
- IF_ENABLED
118+
- LISTIFY
119+
- STRINGIFY
120+
- Z_STRINGIFY
121+
- DT_FOREACH_PROP_ELEM_SEP

‎.github/workflows/format_check.yml‎

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: 'Format Check'
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
paths:
8+
- '**/*.c'
9+
- '**/*.cpp'
10+
- '**/*.h'
11+
- '**/*.hpp'
12+
13+
pull_request:
14+
types:
15+
- opened
16+
- edited
17+
- reopened
18+
- synchronize
19+
branches:
20+
- 'main'
21+
paths:
22+
- '**/*.c'
23+
- '**/*.cpp'
24+
- '**/*.h'
25+
- '**/*.hpp'
26+
27+
workflow_dispatch:
28+
inputs:
29+
logLevel:
30+
description: 'Log level'
31+
required: true
32+
default: 'warning'
33+
34+
jobs:
35+
format-check:
36+
runs-on: ubuntu-latest
37+
strategy:
38+
matrix:
39+
path:
40+
- check: 'cores/arduino/'
41+
exclude: 'cores/arduino/api/'
42+
- check: 'loader/'
43+
exclude: 'loader/llext_exports\.c$'
44+
- check: 'libraries/'
45+
exclude: 'examples'
46+
exclude: 'extras'
47+
exclude: 'ea_malloc'
48+
fail-fast: false
49+
50+
steps:
51+
- name: Checkout code
52+
uses: actions/checkout@v4
53+
with:
54+
submodules: false
55+
persist-credentials: false
56+
57+
- name: Run clang-format check
58+
uses: jidicula/clang-format-action@v4.15.0
59+
with:
60+
clang-format-version: '19'
61+
check-path: ${{ matrix.path['check'] }}
62+
exclude-regex: ${{ matrix.path['exclude'] }}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /