Skip to content

Commit 050c7dc

Browse files
committed
Add Prettier and YAMLLint
1 parent eae2872 commit 050c7dc

File tree

2 files changed

+99
-6
lines changed

2 files changed

+99
-6
lines changed

Diff for: .pre-commit-config.yaml

+23-6
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ repos:
44
hooks:
55
- id: check-case-conflict
66
- id: check-symlinks
7-
- id: check-yaml
87
- id: debug-statements
98
- id: destroyed-symlinks
109
- id: detect-private-key
1110
- id: end-of-file-fixer
1211
- id: mixed-line-ending
13-
args: [--fix=lf]
12+
args:
13+
- --fix=lf
1414
- id: trailing-whitespace
15-
args: [--markdown-linebreak-ext=md]
15+
args:
16+
- --markdown-linebreak-ext=md
1617
- repo: https://github.com/codespell-project/codespell
1718
rev: v2.2.4
1819
hooks:
@@ -21,19 +22,35 @@ repos:
2122
rev: v15.0.7
2223
hooks:
2324
- id: clang-format
24-
types_or: [c, c++]
25+
types_or:
26+
- c
27+
- c++
2528
- repo: https://github.com/psf/black-pre-commit-mirror
2629
rev: 22.10.0
2730
hooks:
2831
- id: black
2932
language_version: python3.8
30-
args: [--line-length=120] #From the arduino code style. Add as argument rather than creating a new config file.
33+
args:
34+
- --line-length=120 #From the arduino code style. Add as argument rather than creating a new config file.
3135
- repo: https://github.com/PyCQA/flake8
3236
rev: 7.0.0
3337
hooks:
3438
- id: flake8
35-
types_or: [python]
39+
types_or:
40+
- python
3641
additional_dependencies:
3742
- flake8-bugbear
3843
- flake8-comprehensions
3944
- flake8-simplify
45+
- repo: https://github.com/pre-commit/mirrors-prettier
46+
rev: v3.1.0
47+
hooks:
48+
- id: prettier
49+
types_or:
50+
- yaml
51+
- repo: https://github.com/adrienverge/yamllint
52+
rev: v1.33.0
53+
hooks:
54+
- id: yamllint
55+
types_or:
56+
- yaml

Diff for: .yamllint.yml

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-yaml/.yamllint.yml
2+
# See: https://yamllint.readthedocs.io/en/stable/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+
# Note: Rules disabled solely because they are redundant to Prettier are marked with a "Prettier" comment.
6+
7+
rules:
8+
braces:
9+
level: error
10+
forbid: non-empty
11+
min-spaces-inside: -1 # Prettier
12+
max-spaces-inside: -1 # Prettier
13+
min-spaces-inside-empty: -1 # Prettier
14+
max-spaces-inside-empty: -1 # Prettier
15+
brackets:
16+
level: error
17+
forbid: non-empty
18+
min-spaces-inside: -1 # Prettier
19+
max-spaces-inside: -1 # Prettier
20+
min-spaces-inside-empty: -1 # Prettier
21+
max-spaces-inside-empty: -1 # Prettier
22+
colons: disable # Prettier
23+
commas: disable # Prettier
24+
comments: disable # Prettier
25+
comments-indentation: disable # Prettier
26+
document-end: disable # Prettier
27+
document-start: disable
28+
empty-lines: disable # Prettier
29+
empty-values: disable
30+
hyphens: disable # Prettier
31+
indentation: disable # Prettier
32+
key-duplicates: disable # Prettier
33+
key-ordering: disable
34+
line-length:
35+
level: warning
36+
max: 120
37+
allow-non-breakable-words: true
38+
allow-non-breakable-inline-mappings: true
39+
new-line-at-end-of-file: disable # Prettier
40+
new-lines: disable # Prettier
41+
octal-values:
42+
level: warning
43+
forbid-implicit-octal: true
44+
forbid-explicit-octal: false
45+
quoted-strings: disable
46+
trailing-spaces: disable # Prettier
47+
truthy:
48+
level: error
49+
allowed-values:
50+
- "true"
51+
- "false"
52+
- "on" # Used by GitHub Actions as a workflow key.
53+
check-keys: true
54+
55+
yaml-files:
56+
# Source: https://github.com/ikatyang/linguist-languages/blob/master/data/YAML.json (used by Prettier)
57+
- ".clang-format"
58+
- ".clang-tidy"
59+
- ".gemrc"
60+
- ".yamllint"
61+
- "glide.lock"
62+
- "*.yml"
63+
- "*.mir"
64+
- "*.reek"
65+
- "*.rviz"
66+
- "*.sublime-syntax"
67+
- "*.syntax"
68+
- "*.yaml"
69+
- "*.yaml-tmlanguage"
70+
- "*.yaml.sed"
71+
- "*.yml.mysql"
72+
73+
ignore: |
74+
/.git/
75+
.clang-format
76+
__pycache__/

0 commit comments

Comments
 (0)