-
Notifications
You must be signed in to change notification settings - Fork 10
/
.swiftlint.yml
78 lines (58 loc) · 2.04 KB
/
.swiftlint.yml
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
# paths to ignore during linting. Takes precedence over `included`.
excluded:
- Templates
- Healthy/Resources/Generated/
# Some rules are turned off by default, so we need to opt-in
opt_in_rules:
# Prefer checking isEmpty over comparing count to zero
- empty_count
# Force casts should be avoided
- force_cast
# Force unwrapping should be avoided
- force_unwrapping
# Header comments should be consistent with project patterns.
- file_header
# MARK comment should be in valid format. e.g. ‘// MARK: …’ or ‘// MARK: - …’
- mark
# Function parameters should be aligned vertically if they’re in multiple lines in a method call
- vertical_parameter_alignment_on_call
# Use shorthand syntax for optional binding
- shorthand_optional_binding
- custom_rules
# By default, SwiftLint uses a set of sensible default rules you can adjust:
disabled_rules: # rule identifiers turned on by default to exclude from running
# TODOs and FIXMEs should be resolved.
- todo
# swiftlint:disable commands should be re-enabled before the end of the file
- blanket_disable_command
# configurable rules can be customized from this configuration file
# binary rules can set their severity level
force_cast: warning
force_unwrapping: error
force_try:
severity: error
line_length: 120
type_body_length:
- 300 # warning
- 400 # error
# or they can set both explicitly
file_length:
error: 400
# naming rules can set warnings/errors for min_length and max_length
# additionally they can set excluded names
type_name:
allowed_symbols: ["_"] # these are allowed in type names
identifier_name:
excluded: # excluded via string array
- id
- URL
- GlobalAPIKey
file_header:
forbidden_string: "Created by"
custom_rules:
no_lines_around_braces:
name: "No lines before or after closing curly braces"
regex: "(\\s*{[^\\n]*)\\s*\\n{2,}(\\s*\\n)*\\s*([^\\n]*\\n\\s*})"
message: "Don't leave lines before or after closing curly braces"
severity: warning # or error
correction: "$1\n$4"