-
Notifications
You must be signed in to change notification settings - Fork 245
/
Copy pathconfiguration_schema.json
396 lines (396 loc) · 15.4 KB
/
configuration_schema.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Swift Format Configuration",
"description": "Configuration\nhttps://github.com/apple/swift-format/blob/main/Documentation/Configuration.md#swift-format-configuration",
"type": "object",
"properties": {
"version": {
"title": "version",
"type": "number",
"description": "The version of the configuration file. For now, this should always be 1.",
"default": 1,
"enum": [
1
]
},
"lineLength": {
"title": "line length",
"type": "number",
"description": "The maximum allowed length of a line, in characters.",
"default": 100
},
"indentation": {
"title": "indentation",
"type": "object",
"description": "The kind and amount of whitespace that should be added when indenting one level.",
"anyOf": [
{
"type": "object",
"properties": {
"spaces": {
"title": "spaces",
"type": "number",
"description": "One level of indentation is the given number of spaces.",
"default": 2
}
},
"required": [
"spaces"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"tabs": {
"title": "tabs",
"type": "number",
"description": "One level of indentation is the given number of tabs."
}
},
"required": [
"tabs"
],
"additionalProperties": false
}
]
},
"tabWidth": {
"title": "tab width",
"type": "number",
"description": "The number of spaces that should be considered equivalent to one tab character.",
"default": 8
},
"maximumBlankLines": {
"title": "maximum blank lines",
"type": "number",
"description": "The maximum number of consecutive blank lines that are allowed to be present in a source file.",
"default": 1
},
"respectsExistingLineBreaks": {
"title": "respects existing line breaks",
"type": "boolean",
"description": "Indicates whether or not existing line breaks in the source code should be honored.",
"default": true
},
"lineBreakBeforeControlFlowKeywords": {
"title": "line break before control flow keywords",
"type": "boolean",
"description": "Determines the line-breaking behavior for control flow keywords that follow a closing brace.",
"default": false
},
"lineBreakBeforeEachArgument": {
"title": "line break before each argument",
"type": "boolean",
"description": "Determines the line-breaking behavior for generic arguments and function arguments when a declaration is wrapped onto multiple lines.",
"default": false
},
"lineBreakBeforeEachGenericRequirement": {
"title": "line break before each generic requirement",
"type": "boolean",
"description": "Determines the line-breaking behavior for generic requirements when the requirements list is wrapped onto multiple lines.",
"default": false
},
"prioritizeKeepingFunctionOutputTogether": {
"title": "prioritize keeping function output together",
"type": "boolean",
"description": "Determines if function-like declaration outputs should be prioritized to be together with the function signature right (closing) parenthesis.",
"default": false
},
"indentConditionalCompilationBlocks": {
"title": "indent conditional compilation blocks",
"type": "boolean",
"description": "Determines if conditional compilation blocks are indented.",
"default": true
},
"lineBreakAroundMultilineExpressionChainComponents": {
"title": "line break around multiline expression chain components",
"type": "boolean",
"description": "Determines whether line breaks should be forced before and after multiline components of dot-chained expressions.",
"default": false
},
"spacesAroundRangeFormationOperators": {
"title": "spaces around range formation operators",
"type": "boolean",
"description": "Determines whether whitespace should be forced before and after the range formation operators.",
"default": false
},
"multiElementCollectionTrailingCommas": {
"title": "multi-element collection trailing commas",
"type": "boolean",
"description": "Determines whether multi-element collection literals should have trailing commas.",
"default": true
},
"indentSwitchCaseLabels": {
"type": "boolean",
"description": "Determines if case statements should be indented compared to the containing switch block.",
"default": false
},
"fileScopedDeclarationPrivacy": {
"title": "file-scoped declaration privacy",
"type": "object",
"description": "Determines the formal access level for file-scoped declarations whose effective access level is private to the containing file.",
"properties": {
"accessLevel": {
"title": "access level",
"anyOf": [
{
"type": "string",
"enum": [
"private"
],
"description": "Private file-scoped declarations should be declared 'private'. If a file-scoped declaration is declared 'fileprivate', it will be diagnosed (in lint mode) or changed to 'private' (in format mode).",
"default": "private"
},
{
"type": "string",
"enum": [
"fileprivate"
],
"description": "Private file-scoped declarations should be declared 'fileprivate'. If a file-scoped declaration is declared 'private', it will be diagnosed (in lint mode) or changed to 'fileprivate' (in format mode)."
}
]
}
},
"required": [
"accessLevel"
],
"additionalProperties": false
},
"noAssignmentInExpressions": {
"title": "no assignment in expressions",
"type": "object",
"description": "Contains exceptions for the NoAssignmentInExpressions rule.",
"properties": {
"allowedFunctions": {
"type": "array",
"items": {
"type": "string"
},
"description": "A list of function names where assignments are allowed to be embedded in expressions that are passed as parameters to that function.",
"default": [
"XCTAssertNoThrow"
]
}
},
"additionalProperties": false
},
"rules": {
"title": "rules",
"type": "object",
"description": "Specifies which rules to apply when linting and formatting your project.",
"properties": {
"AllPublicDeclarationsHaveDocumentation": {
"type": "boolean",
"description": "All public or open declarations must have a top-level documentation comment.",
"default": false
},
"AlwaysUseLiteralForEmptyCollectionInit": {
"type": "boolean",
"description": "Never use [<Type>] syntax. In call sites that should be replaced with [], for initializations use explicit type combined with empty array literal let _: [<Type>] = [] Static properties of a type that return that type should not include a reference to their type.",
"default": false
},
"AlwaysUseLowerCamelCase": {
"type": "boolean",
"description": "All values should be written in lower camel-case (lowerCamelCase). Underscores (except at the beginning of an identifier) are disallowed.",
"default": true
},
"AmbiguousTrailingClosureOverload": {
"type": "boolean",
"description": "Overloads with only a closure argument should not be disambiguated by parameter labels.",
"default": true
},
"BeginDocumentationCommentWithOneLineSummary": {
"type": "boolean",
"description": "All documentation comments must begin with a one-line summary of the declaration.",
"default": false
},
"DoNotUseSemicolons": {
"type": "boolean",
"description": "Semicolons should not be present in Swift code.",
"default": true
},
"DontRepeatTypeInStaticProperties": {
"type": "boolean",
"description": "Static properties of a type that return that type should not include a reference to their type.",
"default": true
},
"FileScopedDeclarationPrivacy": {
"type": "boolean",
"description": "Declarations at file scope with effective private access should be consistently declared as either fileprivate or private, determined by configuration.",
"default": true
},
"FullyIndirectEnum": {
"type": "boolean",
"description": "If all cases of an enum are indirect, the entire enum should be marked indirect.",
"default": true
},
"GroupNumericLiterals": {
"type": "boolean",
"description": "Numeric literals should be grouped with _s to delimit common separators.",
"default": true
},
"IdentifiersMustBeASCII": {
"type": "boolean",
"description": "All identifiers must be ASCII.",
"default": true
},
"NeverForceUnwrap": {
"type": "boolean",
"description": "Force-unwraps are strongly discouraged and must be documented.",
"default": false
},
"NeverUseForceTry": {
"type": "boolean",
"description": "Force-try (try!) is forbidden.",
"default": false
},
"NeverUseImplicitlyUnwrappedOptionals": {
"type": "boolean",
"description": "Implicitly unwrapped optionals (e.g. var s: String!) are forbidden.",
"default": false
},
"NoAccessLevelOnExtensionDeclaration": {
"type": "boolean",
"description": "Specifying an access level for an extension declaration is forbidden.",
"default": true
},
"NoAssignmentInExpressions": {
"type": "boolean",
"description": "Assignment expressions must be their own statements.",
"default": true
},
"NoBlockComments": {
"type": "boolean",
"description": "Block comments should be avoided in favor of line comments.",
"default": true
},
"NoCasesWithOnlyFallthrough": {
"type": "boolean",
"description": "Cases that contain only the fallthrough statement are forbidden.",
"default": true
},
"NoEmptyTrailingClosureParentheses": {
"type": "boolean",
"description": "Function calls with no arguments and a trailing closure should not have empty parentheses.",
"default": true
},
"NoLabelsInCasePatterns": {
"type": "boolean",
"description": "Redundant labels are forbidden in case patterns.",
"default": true
},
"NoLeadingUnderscores": {
"type": "boolean",
"description": "Identifiers in declarations and patterns should not have leading underscores.",
"default": false
},
"NoParensAroundConditions": {
"type": "boolean",
"description": "Enforces rules around parentheses in conditions or matched expressions.",
"default": true
},
"NoPlaygroundLiterals": {
"type": "boolean",
"description": "The playground literals (#colorLiteral, #fileLiteral, and #imageLiteral) are forbidden.",
"default": false
},
"NoVoidReturnOnFunctionSignature": {
"type": "boolean",
"description": "Functions that return () or Void should omit the return signature.",
"default": true
},
"OmitExplicitReturns": {
"type": "boolean",
"description": "Single-expression functions, closures, subscripts can omit return statement.",
"default": true
},
"OneCasePerLine": {
"type": "boolean",
"description": "Each enum case with associated values or a raw value should appear in its own case declaration.",
"default": true
},
"OneVariableDeclarationPerLine": {
"type": "boolean",
"description": "Each variable declaration, with the exception of tuple destructuring, should declare 1 variable.",
"default": true
},
"OnlyOneTrailingClosureArgument": {
"type": "boolean",
"description": "Function calls should never mix normal closure arguments and trailing closures.",
"default": true
},
"OrderedImports": {
"type": "boolean",
"description": "Imports must be lexicographically ordered and logically grouped at the top of each source file.",
"default": true
},
"ReplaceForEachWithForLoop": {
"type": "boolean",
"description": "Replace forEach with for-in loop unless its argument is a function reference.",
"default": false
},
"ReturnVoidInsteadOfEmptyTuple": {
"type": "boolean",
"description": "Return Void, not (), in signatures.",
"default": true
},
"TypeNamesShouldBeCapitalized": {
"type": "boolean",
"description": "struct, class, enum and protocol declarations should have a capitalized name.",
"default": true
},
"UseEarlyExits": {
"type": "boolean",
"description": "Early exits should be used whenever possible.",
"default": false
},
"UseExplicitNilCheckInConditions": {
"type": "boolean",
"description": "When checking an optional value for nil-ness, prefer writing an explicit nil check rather than binding and immediately discarding the value.",
"default": false
},
"UseLetInEveryBoundCaseVariable": {
"type": "boolean",
"description": "Every variable bound in a case pattern must have its own let/var.",
"default": true
},
"UseShorthandTypeNames": {
"type": "boolean",
"description": "Shorthand type forms must be used wherever possible.",
"default": true
},
"UseSingleLinePropertyGetter": {
"type": "boolean",
"description": "Read-only computed properties must use implicit get blocks.",
"default": true
},
"UseSynthesizedInitializer": {
"type": "boolean",
"description": "When possible, the synthesized struct initializer should be used.",
"default": true
},
"UseTripleSlashForDocumentationComments": {
"type": "boolean",
"description": "Documentation comments must use the /// form.",
"default": true
},
"UseWhereClausesInForLoops": {
"type": "boolean",
"description": "for loops that consist of a single if statement must use where clauses instead.",
"default": false
},
"ValidateDocumentationComments": {
"type": "boolean",
"description": "Documentation comments must be complete and valid.",
"default": false
}
},
"additionalProperties": false
}
},
"required": [
"version"
],
"additionalProperties": false
}