Skip to content

Commit 87c7d8b

Browse files
committed
Merge branch 'ci/pre-commit-ci_test' into ci/style_check
2 parents 1149650 + 30f0e98 commit 87c7d8b

File tree

8 files changed

+432
-0
lines changed

8 files changed

+432
-0
lines changed

.clang-format

+190
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/tree/main/other/clang-format-configuration
2+
---
3+
AccessModifierOffset: -2
4+
AlignAfterOpenBracket: Align
5+
AlignArrayOfStructures: None
6+
AlignConsecutiveAssignments: None
7+
AlignConsecutiveBitFields: None
8+
AlignConsecutiveDeclarations: None
9+
AlignConsecutiveMacros: None
10+
AlignEscapedNewlines: DontAlign
11+
AlignOperands: Align
12+
AlignTrailingComments: true
13+
AllowAllArgumentsOnNextLine: true
14+
AllowAllConstructorInitializersOnNextLine: true
15+
AllowAllParametersOfDeclarationOnNextLine: true
16+
AllowShortBlocksOnASingleLine: Always
17+
AllowShortCaseLabelsOnASingleLine: true
18+
AllowShortEnumsOnASingleLine: true
19+
AllowShortFunctionsOnASingleLine: Empty
20+
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
21+
AllowShortLambdasOnASingleLine: Empty
22+
AllowShortLoopsOnASingleLine: true
23+
AlwaysBreakAfterDefinitionReturnType: None
24+
AlwaysBreakAfterReturnType: None
25+
AlwaysBreakBeforeMultilineStrings: false
26+
AlwaysBreakTemplateDeclarations: No
27+
AttributeMacros:
28+
- __capability
29+
BasedOnStyle: LLVM
30+
BinPackArguments: true
31+
BinPackParameters: true
32+
BitFieldColonSpacing: Both
33+
BraceWrapping:
34+
AfterCaseLabel: false
35+
AfterClass: false
36+
AfterControlStatement: Never
37+
AfterEnum: false
38+
AfterFunction: false
39+
AfterNamespace: false
40+
AfterObjCDeclaration: false
41+
AfterStruct: false
42+
AfterUnion: false
43+
AfterExternBlock: false
44+
BeforeCatch: false
45+
BeforeElse: false
46+
BeforeLambdaBody: false
47+
BeforeWhile: false
48+
IndentBraces: false
49+
SplitEmptyFunction: true
50+
SplitEmptyRecord: true
51+
SplitEmptyNamespace: true
52+
BreakAfterJavaFieldAnnotations: false
53+
BreakBeforeBinaryOperators: NonAssignment
54+
BreakBeforeBraces: Attach
55+
BreakBeforeConceptDeclarations: false
56+
BreakBeforeInheritanceComma: false
57+
BreakBeforeTernaryOperators: true
58+
BreakConstructorInitializers: BeforeColon
59+
BreakConstructorInitializersBeforeComma: false
60+
BreakInheritanceList: BeforeColon
61+
BreakStringLiterals: false
62+
ColumnLimit: 0
63+
CommentPragmas: ''
64+
CompactNamespaces: false
65+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
66+
ConstructorInitializerIndentWidth: 2
67+
ContinuationIndentWidth: 2
68+
Cpp11BracedListStyle: false
69+
DeriveLineEnding: true
70+
DerivePointerAlignment: true
71+
DisableFormat: false
72+
EmptyLineAfterAccessModifier: Leave
73+
EmptyLineBeforeAccessModifier: Leave
74+
ExperimentalAutoDetectBinPacking: false
75+
FixNamespaceComments: false
76+
ForEachMacros:
77+
- foreach
78+
- Q_FOREACH
79+
- BOOST_FOREACH
80+
IfMacros:
81+
- KJ_IF_MAYBE
82+
IncludeBlocks: Preserve
83+
IncludeCategories:
84+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
85+
Priority: 2
86+
SortPriority: 0
87+
CaseSensitive: false
88+
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
89+
Priority: 3
90+
SortPriority: 0
91+
CaseSensitive: false
92+
- Regex: '.*'
93+
Priority: 1
94+
SortPriority: 0
95+
CaseSensitive: false
96+
IncludeIsMainRegex: ''
97+
IncludeIsMainSourceRegex: ''
98+
IndentAccessModifiers: false
99+
IndentCaseBlocks: true
100+
IndentCaseLabels: true
101+
IndentExternBlock: Indent
102+
IndentGotoLabels: false
103+
IndentPPDirectives: None
104+
IndentRequires: true
105+
IndentWidth: 2
106+
IndentWrappedFunctionNames: false
107+
InsertTrailingCommas: None
108+
JavaScriptQuotes: Leave
109+
JavaScriptWrapImports: true
110+
KeepEmptyLinesAtTheStartOfBlocks: true
111+
LambdaBodyIndentation: Signature
112+
Language: Cpp
113+
MacroBlockBegin: ''
114+
MacroBlockEnd: ''
115+
MaxEmptyLinesToKeep: 100000
116+
NamespaceIndentation: None
117+
ObjCBinPackProtocolList: Auto
118+
ObjCBlockIndentWidth: 2
119+
ObjCBreakBeforeNestedBlockParam: true
120+
ObjCSpaceAfterProperty: false
121+
ObjCSpaceBeforeProtocolList: true
122+
PPIndentWidth: -1
123+
PackConstructorInitializers: BinPack
124+
PenaltyBreakAssignment: 1
125+
PenaltyBreakBeforeFirstCallParameter: 1
126+
PenaltyBreakComment: 1
127+
PenaltyBreakFirstLessLess: 1
128+
PenaltyBreakOpenParenthesis: 1
129+
PenaltyBreakString: 1
130+
PenaltyBreakTemplateDeclaration: 1
131+
PenaltyExcessCharacter: 1
132+
PenaltyIndentedWhitespace: 1
133+
PenaltyReturnTypeOnItsOwnLine: 1
134+
PointerAlignment: Right
135+
QualifierAlignment: Leave
136+
ReferenceAlignment: Pointer
137+
ReflowComments: false
138+
RemoveBracesLLVM: false
139+
SeparateDefinitionBlocks: Leave
140+
ShortNamespaceLines: 0
141+
SortIncludes: Never
142+
SortJavaStaticImport: Before
143+
SortUsingDeclarations: false
144+
SpaceAfterCStyleCast: false
145+
SpaceAfterLogicalNot: false
146+
SpaceAfterTemplateKeyword: false
147+
SpaceAroundPointerQualifiers: Default
148+
SpaceBeforeAssignmentOperators: true
149+
SpaceBeforeCaseColon: false
150+
SpaceBeforeCpp11BracedList: false
151+
SpaceBeforeCtorInitializerColon: true
152+
SpaceBeforeInheritanceColon: true
153+
SpaceBeforeParens: ControlStatements
154+
SpaceBeforeParensOptions:
155+
AfterControlStatements: true
156+
AfterForeachMacros: true
157+
AfterFunctionDefinitionName: false
158+
AfterFunctionDeclarationName: false
159+
AfterIfMacros: true
160+
AfterOverloadedOperator: false
161+
BeforeNonEmptyParentheses: false
162+
SpaceBeforeRangeBasedForLoopColon: true
163+
SpaceBeforeSquareBrackets: false
164+
SpaceInEmptyBlock: false
165+
SpaceInEmptyParentheses: false
166+
SpacesBeforeTrailingComments: 2
167+
SpacesInAngles: Leave
168+
SpacesInCStyleCastParentheses: false
169+
SpacesInConditionalStatement: false
170+
SpacesInContainerLiterals: false
171+
SpacesInLineCommentPrefix:
172+
Minimum: 0
173+
Maximum: -1
174+
SpacesInParentheses: false
175+
SpacesInSquareBrackets: false
176+
Standard: Auto
177+
StatementAttributeLikeMacros:
178+
- Q_EMIT
179+
StatementMacros:
180+
- Q_UNUSED
181+
- QT_REQUIRE_VERSION
182+
TabWidth: 2
183+
UseCRLF: false
184+
UseTab: Never
185+
WhitespaceSensitiveMacros:
186+
- STRINGIZE
187+
- PP_STRINGIZE
188+
- BOOST_PP_STRINGIZE
189+
- NS_SWIFT_NAME
190+
- CF_SWIFT_NAME

.codespellrc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[codespell]
2+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check/.codespellrc
3+
# In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here:
4+
ignore-words-list = ba,licence,ot,dout,als
5+
skip = ./.git,./.licenses,__pycache__,.clang-format,.editorconfig,.flake8,.prettierignore,.yamllint.yml,.gitignore,boards.txt,platform.txt,programmers.txt
6+
builtin = clear,informal,en-GB_to_en-US
7+
check-filenames =
8+
check-hidden =
9+
write-changes =

.editorconfig

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/general/.editorconfig
2+
# See: https://editorconfig.org/
3+
# The formatting style defined in this file is the official standardized style to be used in all Arduino Tooling
4+
# projects and should not be modified.
5+
# Note: indent style for each file type is defined even when it matches the universal config in order to make it clear
6+
# that this type has an official style.
7+
8+
[*]
9+
charset = utf-8
10+
end_of_line = lf
11+
indent_size = 2
12+
indent_style = space
13+
insert_final_newline = true
14+
trim_trailing_whitespace = true
15+
16+
[*.{adoc,asc,asciidoc}]
17+
indent_size = 2
18+
indent_style = space
19+
20+
[*.{bash,sh}]
21+
indent_size = 2
22+
indent_style = space
23+
24+
[*.{c,cc,cp,cpp,cxx,h,hh,hpp,hxx,ii,inl,ino,ixx,pde,tpl,tpp,txx}]
25+
indent_size = 2
26+
indent_style = space
27+
28+
[*.{go,mod}]
29+
indent_style = tab
30+
31+
[*.java]
32+
indent_size = 2
33+
indent_style = space
34+
35+
[*.{js,jsx,json,jsonc,json5,ts,tsx}]
36+
indent_size = 2
37+
indent_style = space
38+
39+
[*.{md,mdx,mkdn,mdown,markdown}]
40+
indent_size = unset
41+
indent_style = space
42+
43+
[*.proto]
44+
indent_size = 2
45+
indent_style = space
46+
47+
[*.py]
48+
indent_size = 4
49+
indent_style = space
50+
51+
[*.svg]
52+
indent_size = 2
53+
indent_style = space
54+
55+
[*.{yaml,yml}]
56+
indent_size = 2
57+
indent_style = space
58+
59+
[{.gitconfig,.gitmodules}]
60+
indent_style = tab

.flake8

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-python/.flake8
2+
# See: https://flake8.pycqa.org/en/latest/user/configuration.html
3+
# The code style defined in this file is the official standardized style to be used in all Arduino tooling projects and
4+
# should not be modified.
5+
6+
[flake8]
7+
doctests = True
8+
# W503 and W504 are mutually exclusive. PEP 8 recommends line break before.
9+
ignore = W503
10+
max-complexity = 10
11+
max-line-length = 120
12+
select = E,W,F,C,N

.github/workflows/pre-commit.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Pre-commit check
2+
3+
on:
4+
pull_request:
5+
jobs:
6+
lint:
7+
name: Checking if any fixes are needed
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
with:
12+
fetch-depth: 0
13+
- uses: actions/setup-python@v4
14+
with:
15+
python-version: 3.8
16+
- id: changed-files
17+
uses: tj-actions/changed-files@v36
18+
- uses: pre-commit/[email protected]
19+
with:
20+
extra_args: --files ${{ steps.changed-files.outputs.all_changed_files }}
21+
- uses: pre-commit-ci/[email protected]
22+
if: always()

.pre-commit-config.yaml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: "v4.5.0"
4+
hooks:
5+
- id: check-case-conflict
6+
- id: check-symlinks
7+
- id: debug-statements
8+
- id: destroyed-symlinks
9+
- id: detect-private-key
10+
- id: end-of-file-fixer
11+
- id: mixed-line-ending
12+
args:
13+
- --fix=lf
14+
- id: trailing-whitespace
15+
args:
16+
- --markdown-linebreak-ext=md
17+
- repo: https://github.com/codespell-project/codespell
18+
rev: "v2.2.4"
19+
hooks:
20+
- id: codespell
21+
exclude: ^.*\.(svd|SVD)$
22+
stages:
23+
- manual
24+
- repo: https://github.com/pre-commit/mirrors-clang-format
25+
rev: "v15.0.7"
26+
hooks:
27+
- id: clang-format
28+
types_or:
29+
- c
30+
- c++
31+
- repo: https://github.com/psf/black-pre-commit-mirror
32+
rev: "22.10.0"
33+
hooks:
34+
- id: black
35+
language_version: python3.8
36+
args:
37+
- --line-length=120 #From the arduino code style. Add as argument rather than creating a new config file.
38+
- repo: https://github.com/PyCQA/flake8
39+
rev: "7.0.0"
40+
hooks:
41+
- id: flake8
42+
types_or:
43+
- python
44+
additional_dependencies:
45+
- flake8-bugbear
46+
- flake8-comprehensions
47+
- flake8-simplify
48+
- repo: https://github.com/pre-commit/mirrors-prettier
49+
rev: "v3.1.0"
50+
hooks:
51+
- id: prettier
52+
types_or:
53+
- yaml
54+
- repo: https://github.com/adrienverge/yamllint
55+
rev: "v1.33.0"
56+
hooks:
57+
- id: yamllint
58+
types_or:
59+
- yaml

.prettierignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
__pycache__/
2+
.clang-format
3+
.licenses/
4+
/.git/

0 commit comments

Comments
 (0)