-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.swiftlint.yml
166 lines (137 loc) · 4.44 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
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
excluded:
- Pods
- Tests
- Sources/Serializers/Protobuf/Proto
disabled_rules:
- identifier_name
- trailing_whitespace
- type_name
- empty_enum_arguments
- unused_enumerated
opt_in_rules:
- switch_case_on_newline
- closure_spacing
- closure_end_indentation
- file_header
- number_separator
- operator_usage_whitespace
- redundant_nil_coalescing
- conditional_returns_on_newline
- discouraged_optional_boolean
- empty_count
- empty_string
- literal_expression_end_indentation
- force_unwrapping
function_body_length:
warning: 40
error: 100
type_body_length:
warning: 500
large_tuple:
warning: 3
error: 4
line_length:
warning: 300
error: 400
ignores_urls: true
ignores_function_declarations: true
ignores_comments: true
number_separator:
minimum_length: 0
cyclomatic_complexity:
warning: 10
error: 20
ignores_case_statements: false
file_length:
warning: 1000
error: 10000000
nesting:
type_level:
warning: 2
comma: warning
force_try: warning
force_cast: warning
empty_count: warning
switch_case_alignment:
indented_cases: true
custom_rules:
no_empty_header:
regex: '^\s*\n+import'
message: "There should NOT be empty lines in file header"
severity: error
no_empty_first_line:
regex: '\{\s*\n\s*\n'
message: "There should NOT be an empty line after a declaration"
severity: warning
bracket:
regex: '(\}\s*\n\s*\n\}|\{\s*\n\s*\n\s*\{)'
message: "No empty line between two open or close brackets."
severity: error
empty_brackets:
regex: '(\{\s{1,}\})'
message: "Empty brackets must not have white space, use {} instead."
severity: warning
# From https://github.com/Twigz/Game
force_https:
name: "Force HTTPS over HTTP"
regex: "((?i)http(?!s))"
match_kinds: string
message: "HTTPS should be favored over HTTP"
severity: warning
# From https://github.com/onelittlefish/ObjectiveSet
trailing_whitespace_permissive:
name: Trailing Whitespace (excluding whitespace-only lines)
# This will only catch some trailing whitespace due to swiftlint's custom regex
# implementation and how it filters for match_kinds.
# This alternative regex will catch more (but still not all) cases:
# "\S+[\S\t\f\p{Z}]+[\t\f\p{Z}]+\n" but it is much less performant.
# Examples that won't be caught:
# closing brace by itself followed by space (not caught by either regex),
# func declaration followed by space after the opening brace (would be caught by
# less performant regex)
regex: "\\S+[\t\f\\p{Z}]+\n"
message: "Lines should not have trailing whitespace."
# From https://github.com/brandenr/swiftlintconfig
comments_space:
name: "Space After Comment"
regex: "(^ *//\\w+)"
message: "There should be a space after //"
severity: warning
comments_capitalized_ignore_possible_code:
name: "Capitalize First Word In Comment"
regex: "(^ +// +(?!swiftlint)[a-z]+)"
message: "The first word of a comment should be capitalized"
severity: warning
comments_capitalized_find_possible_code:
name: "Catch Commented Out Code"
regex: "(^ *// +(?!swiftlint)[a-z]+)"
message: "The first word of a comment should be capitalized"
severity: warning
empty_line_after_guard:
name: "Empty Line After Guard"
regex: "(^ *guard[ a-zA-Z0-9=?.\\(\\),><!]*\\{[ a-zA-Z0-9=?.\\(\\),><!]*\\}\n *(?!(?:return|guard))\\S+)"
message: "There should be an empty line after a guard"
severity: warning
empty_line_after_super:
name: "Empty Line After Super"
regex: "(^ *super\\.[ a-zA-Z0-9=?.\\(\\)\\{\\}:,><!]*\n *(?!(?:\\}|return))\\S+)"
message: "There should be an empty line after super"
severity: warning
multiple_empty_lines:
name: "Multiple Empty Lines"
regex: "((?:\\s*\n){3,})"
message: "There are too many line breaks"
severity: warning
unnecessary_type:
name: "Unnecessary Type"
regex: "[ a-zA-Z0-9]*(?:let|var) [ a-zA-Z0-9]*: ([a-zA-Z0-9]*)[\\? ]*= \\1"
message: "Type Definition Not Needed"
severity: warning
declaration_attributes_on_newline:
regex: '(@(discardableResults|inline[ \t]*\(\S*\)|available[ \t]*(\S*\)))[^\r\n]+)'
message: "Declaration attributes must be on their own line."
severity: warning
access_control_on_same_line:
regex: '(open|public|private|fileprivate|internal)[ \t]*[\r\n]'
message: "Access control modifiers must be on the same line as the type declaration."
severity: warning