Skip to content

Commit d6be030

Browse files
committed
Add yamllint config and fix all errors
Add configuration for yamllint and fix all the errors/warnings. The configuration matches what is used in the Linux kernel tree except single quotes are required and 'check-keys' option is enabled. 'check-keys' depends on a newish version of yamllint, so it hasn't been enabled in the Linux kernel tree yet. Signed-off-by: Rob Herring (Arm) <[email protected]>
1 parent 979fea8 commit d6be030

39 files changed

+275
-205
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ jobs:
2828
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
2929
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
3030
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
31+
- name: Lint with yamllint
32+
run: |
33+
yamllint --strict $(git ls-files '*.yaml')
3134
- name: Test
3235
run: |
3336
test/test-dt-validate.py

.yamllint

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
extends: relaxed
2+
3+
rules:
4+
quoted-strings:
5+
quote-type: single
6+
required: only-when-needed
7+
check-keys: true
8+
extra-allowed:
9+
- '[$^[\\]'
10+
- '^/$'
11+
line-length:
12+
# 80 chars should be enough, but don't fail if a line is longer
13+
max: 110
14+
allow-non-breakable-words: true
15+
level: warning
16+
braces:
17+
min-spaces-inside: 0
18+
max-spaces-inside: 1
19+
min-spaces-inside-empty: 0
20+
max-spaces-inside-empty: 0
21+
brackets:
22+
min-spaces-inside: 0
23+
max-spaces-inside: 1
24+
min-spaces-inside-empty: 0
25+
max-spaces-inside-empty: 0
26+
colons: {max-spaces-before: 0, max-spaces-after: 1}
27+
commas: {min-spaces-after: 1, max-spaces-after: 1}
28+
comments:
29+
require-starting-space: true
30+
min-spaces-from-content: 1
31+
comments-indentation: disable
32+
document-start:
33+
present: true
34+
empty-lines:
35+
max: 3
36+
max-end: 1
37+
empty-values:
38+
forbid-in-block-mappings: true
39+
forbid-in-flow-mappings: true
40+
hyphens:
41+
max-spaces-after: 1
42+
indentation:
43+
spaces: 2
44+
indent-sequences: true
45+
check-multi-line-strings: false
46+
trailing-spaces: false

dtschema/meta-schemas/base.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ properties:
2020
pattern: 'http://devicetree.org/schemas(/[^/ ]+)+\.yaml#'
2121
$schema:
2222
enum:
23-
- "http://devicetree.org/meta-schemas/core.yaml#"
24-
- "http://devicetree.org/meta-schemas/base.yaml#"
23+
- http://devicetree.org/meta-schemas/core.yaml#
24+
- http://devicetree.org/meta-schemas/base.yaml#
2525
title:
2626
maxLength: 100
2727
description:

dtschema/meta-schemas/cell.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ array:
1010
description: cell array properties must define how many entries and what the
1111
entries are when there is more than one entry.
1212
anyOf:
13-
- description: 'Only "maxItems" is required for a single entry if there are
14-
no constraints defined for the values.'
13+
- description: Only "maxItems" is required for a single entry if there are
14+
no constraints defined for the values.
1515
properties:
1616
maxItems:
1717
const: 1

dtschema/meta-schemas/core.yaml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ definitions:
2525

2626
all-properties:
2727
allOf:
28-
- $ref: "#/definitions/core-properties"
28+
- $ref: '#/definitions/core-properties'
2929
- $ref: clocks.yaml#
3030
- $ref: dma.yaml#
3131
- $ref: gpios.yaml#
@@ -86,9 +86,9 @@ definitions:
8686
type:
8787
enum: [ boolean, object ]
8888
properties:
89-
$ref: "#/definitions/all-properties"
89+
$ref: '#/definitions/all-properties'
9090
patternProperties:
91-
$ref: "#/definitions/all-properties"
91+
$ref: '#/definitions/all-properties'
9292
$ref:
9393
pattern: '(#$|#\/)?'
9494

@@ -111,42 +111,42 @@ definitions:
111111
- required: [ $ref ]
112112

113113
dependentRequired:
114-
"#size-cells": [ "#address-cells" ]
114+
'#size-cells': [ '#address-cells' ]
115115
memory-region-names: [ memory-region ]
116116
reg-names: [ reg ]
117117

118118
properties:
119119
patternProperties:
120-
$ref: "#/definitions/all-properties"
120+
$ref: '#/definitions/all-properties'
121121
properties:
122-
$ref: "#/definitions/all-properties"
122+
$ref: '#/definitions/all-properties'
123123
allOf:
124124
items:
125125
properties:
126126
properties:
127-
$ref: "#/definitions/all-properties"
127+
$ref: '#/definitions/all-properties'
128128
patternProperties:
129-
$ref: "#/definitions/all-properties"
129+
$ref: '#/definitions/all-properties'
130130
anyOf:
131131
items:
132132
properties:
133133
properties:
134-
$ref: "#/definitions/all-properties"
134+
$ref: '#/definitions/all-properties'
135135
patternProperties:
136-
$ref: "#/definitions/all-properties"
136+
$ref: '#/definitions/all-properties'
137137
oneOf:
138138
items:
139139
properties:
140140
properties:
141-
$ref: "#/definitions/all-properties"
141+
$ref: '#/definitions/all-properties'
142142
patternProperties:
143-
$ref: "#/definitions/all-properties"
143+
$ref: '#/definitions/all-properties'
144144
if:
145145
properties:
146146
properties:
147-
$ref: "#/definitions/all-properties"
147+
$ref: '#/definitions/all-properties'
148148
patternProperties:
149-
$ref: "#/definitions/all-properties"
149+
$ref: '#/definitions/all-properties'
150150

151151
anyOf:
152152
- required:

dtschema/meta-schemas/interrupts.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ properties:
2828

2929
dependentRequired:
3030
interrupt-map: ['#interrupt-cells']
31-
'interrupt-map-mask': [ interrupt-map ]
31+
interrupt-map-mask: [ interrupt-map ]
3232

3333
dependentSchemas:
34-
'interrupts':
34+
interrupts:
3535
properties:
3636
interrupt-parent: false # interrupt-parent is implicitly allowed (added by tooling)
3737

dtschema/meta-schemas/keywords.yaml

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ definitions:
5252

5353
sub-schemas:
5454
allOf:
55-
- $ref: "#"
55+
- $ref: '#'
5656
- $ref: items.yaml#
5757
- $ref: types.yaml#
5858
propertyNames:
5959
# The subset of keywords allowed for sub-schema
6060
anyOf:
61-
- $ref: "#/definitions/json-schema-prop-names"
62-
- $ref: "#/definitions/overlapping-json-schema-prop-names"
61+
- $ref: '#/definitions/json-schema-prop-names'
62+
- $ref: '#/definitions/overlapping-json-schema-prop-names'
6363

6464
scalar-prop-list:
6565
propertyNames:
@@ -79,19 +79,20 @@ definitions:
7979
# Array keywords should not be mixed with scalar keywords
8080
dependentSchemas:
8181
contains:
82-
$ref: "#/definitions/scalar-prop-list"
82+
$ref: '#/definitions/scalar-prop-list'
8383
items:
84-
$ref: "#/definitions/scalar-prop-list"
84+
$ref: '#/definitions/scalar-prop-list'
8585
maxItems:
86-
$ref: "#/definitions/scalar-prop-list"
86+
$ref: '#/definitions/scalar-prop-list'
8787
minItems:
88-
$ref: "#/definitions/scalar-prop-list"
88+
$ref: '#/definitions/scalar-prop-list'
8989
additionalProperties:
90-
description: "'additionalProperties' depends on 'properties' or 'patternProperties'"
90+
description: >
91+
'additionalProperties' depends on 'properties' or 'patternProperties'
9192
if:
9293
properties:
9394
additionalProperties:
94-
type: boolean
95+
type: boolean
9596
then:
9697
anyOf:
9798
- required: [ type ]
@@ -113,11 +114,11 @@ properties:
113114
propertyNames:
114115
description: A json-schema keyword was found in $defs key.
115116
not:
116-
$ref: "#/definitions/json-schema-prop-names"
117+
$ref: '#/definitions/json-schema-prop-names'
117118
additionalProperties:
118119
description: $defs entries must contain schemas
119120
type: object
120-
$ref: "#/definitions/sub-schemas"
121+
$ref: '#/definitions/sub-schemas'
121122
$ref:
122123
description:
123124
References must start with '/schemas' or be relative to current
@@ -129,38 +130,39 @@ properties:
129130
oneOf:
130131
- type: object
131132
allOf:
132-
- $ref: "#/definitions/sub-schemas"
133+
- $ref: '#/definitions/sub-schemas'
133134
- type: boolean
134135
additionalProperties:
135136
oneOf:
136137
- type: object
137138
allOf:
138-
- $ref: "#/definitions/sub-schemas"
139+
- $ref: '#/definitions/sub-schemas'
139140
- type: boolean
140141
allOf:
141142
uniqueItems: true
142143
items:
143-
$ref: "#/definitions/sub-schemas"
144+
$ref: '#/definitions/sub-schemas'
144145
anyOf:
145146
uniqueItems: true
146147
items:
147-
$ref: "#/definitions/sub-schemas"
148+
$ref: '#/definitions/sub-schemas'
148149
contains:
149-
$ref: "#/definitions/sub-schemas"
150+
$ref: '#/definitions/sub-schemas'
150151
dependencies:
151152
additionalProperties:
152-
$ref: "#/definitions/sub-schemas"
153+
$ref: '#/definitions/sub-schemas'
153154
dependentRequired:
154155
uniqueItems: true
155156
dependentSchemas:
156157
additionalProperties:
157-
$ref: "#/definitions/sub-schemas"
158+
$ref: '#/definitions/sub-schemas'
158159
else:
159-
$ref: "#/definitions/sub-schemas"
160+
$ref: '#/definitions/sub-schemas'
160161
const:
161162
type: [ integer, string ]
162163
enum:
163-
description: '"enum" must be an array of either integers or strings'
164+
description: >
165+
"enum" must be an array of either integers or strings'
164166
type: array
165167
uniqueItems: true
166168
oneOf:
@@ -169,27 +171,27 @@ properties:
169171
- items:
170172
type: string
171173
if:
172-
$ref: "#/definitions/sub-schemas"
174+
$ref: '#/definitions/sub-schemas'
173175
items:
174176
if:
175177
type: object
176178
then:
177-
$ref: "#/definitions/sub-schemas"
179+
$ref: '#/definitions/sub-schemas'
178180
else:
179181
type: array
180182
items:
181-
$ref: "#/definitions/sub-schemas"
183+
$ref: '#/definitions/sub-schemas'
182184
maxItems:
183185
minimum: 1
184186
minItems:
185187
description: An array property has at least 1 item or is not present
186188
minimum: 1
187189
not:
188-
$ref: "#/definitions/sub-schemas"
190+
$ref: '#/definitions/sub-schemas'
189191
oneOf:
190192
allOf:
191193
- items:
192-
$ref: "#/definitions/sub-schemas"
194+
$ref: '#/definitions/sub-schemas'
193195
- description: Use 'enum' rather than 'oneOf' + 'const' entries
194196
not:
195197
items:
@@ -203,38 +205,39 @@ properties:
203205
- description: Fixed strings belong in 'properties', not 'patternProperties'
204206
pattern: '[\^$()*@]'
205207
not:
206-
pattern: '^\^[a-zA-Z0-9,\-._#@]+\$$'
208+
pattern: '^\^[a-zA-Z0-9,\-._#@]+\$$'
207209
- description: A json-schema keyword was found instead of a DT property name.
208210
not:
209-
$ref: "#/definitions/json-schema-prop-names"
211+
$ref: '#/definitions/json-schema-prop-names'
210212
additionalProperties:
211-
$ref: "#/definitions/sub-schemas"
213+
$ref: '#/definitions/sub-schemas'
212214
properties:
213215
propertyNames:
214216
allOf:
215217
- description: Expected a valid DT property name
216-
pattern: "^[#$a-zA-Z][a-zA-Z0-9#,+\\-._@]{0,63}$"
218+
pattern: '^[#$a-zA-Z][a-zA-Z0-9#,+\-._@]{0,63}$'
217219
- description: A json-schema keyword was found instead of a DT property name.
218220
not:
219-
$ref: "#/definitions/json-schema-prop-names"
221+
$ref: '#/definitions/json-schema-prop-names'
220222
additionalProperties:
221223
type: [ object, boolean ]
222-
$ref: "#/definitions/sub-schemas"
224+
$ref: '#/definitions/sub-schemas'
223225
required:
224-
description: "'required' must be valid DT property or node names"
226+
description: >
227+
'required' must be valid DT property or node names
225228
type: array
226229
uniqueItems: true
227230
items:
228231
pattern: '^([a-zA-Z#][a-zA-Z0-9#,+\-._@]{0,63}|\$nodename)$'
229232
select:
230-
$ref: "#/definitions/sub-schemas"
233+
$ref: '#/definitions/sub-schemas'
231234
then:
232-
$ref: "#/definitions/sub-schemas"
235+
$ref: '#/definitions/sub-schemas'
233236
unevaluatedProperties:
234237
if:
235238
type: object
236239
then:
237-
$ref: "#/definitions/sub-schemas"
240+
$ref: '#/definitions/sub-schemas'
238241
else:
239242
type: boolean
240243
uniqueItems:

dtschema/meta-schemas/nodes.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ $schema: https://json-schema.org/draft/2019-09/schema
77

88
type: object
99

10-
description: 'DT nodes ("object" type in schemas) can only use a subset of json-schema keywords'
10+
description: DT nodes ("object" type in schemas) can only use a subset of json-schema keywords.
1111

1212
properties:
1313
type:

dtschema/meta-schemas/string-array.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
---
66
$id: http://devicetree.org/meta-schemas/string-array.yaml#
77
$schema: https://json-schema.org/draft/2019-09/schema
8-
#type: object
98

109
if:
1110
not:

0 commit comments

Comments
 (0)