-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy path.swiftlint.yml
90 lines (83 loc) · 2.76 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
opt_in_rules:
- attributes
- closure_end_indentation
- closure_spacing
- empty_count
- explicit_init
- fatal_error_message
- first_where
- implicitly_unwrapped_optional
- number_separator
- operator_usage_whitespace
- redundant_nil_coalescing
- unneeded_parentheses_in_closure_argument
- vertical_parameter_alignment_on_call
- force_unwrapping
- prohibited_super_call
disabled_rules:
- redundant_string_enum_value
- superfluous_disable_command
- large_tuple
- identifier_name
- multiple_closure_params
included:
- Source
excluded:
- Source/Tests
- Carthage
line_length:
warning: 180
ignores_comments: true
ignores_function_declarations: true
file_length:
ignore_comment_only_lines: true
trailing_comma:
mandatory_comma: true
custom_rules:
late_force_unwrapping:
included: ".*.swift"
regex: '\(\S+\?\.\S+\)!'
name: "Late Force Unwrapping"
message: "Don't use ? first to force unwrap later – directly unwrap within the parantheses."
severity: warning
missing_docs:
included: ".*.swift"
regex: '\n *(?!\/\/\/)(\/\/)?[^\n\/]*\n *(?:@\S+ )*(?:public|open)'
name: "Missing Docs"
message: "Types, properties and methods with public or open access level should be documented."
severity: warning
multiple_closure_params:
included: ".*.swift"
regex: '\} *\) *\{'
name: "Multiple Closure Params"
message: "Don't use multiple in-line closures – save one or more of them to variables instead."
severity: warning
single_line_return:
included: ".*.swift"
regex: '\.\S+ *\{(?: *return|[^\n\}]+ in return) [^\}]+\}'
name: "Single Line Return"
message: "Remove the 'return' when returning from a single line closure."
severity: warning
unnecessary_case_break:
included: ".*.swift"
regex: '(case |default)(?:[^\n\}]+\n){2,}\s*break *\n|\n *\n *break(?:\n *\n|\n *\})'
name: "Unnecessary Case Break"
message: "Don't use break in switch cases – Swift breaks by default."
severity: warning
unnecessary_nil_assignment:
included: ".*.swift"
regex: 'var \S+\s*:\s*[^\s]+\?\s*=\s*nil'
name: "Unnecessary Nil Assignment"
message: "Don't assign nil as a value when defining an optional type – it's nil by default."
severity: warning
vertical_whitespaces_around_mark:
included: ".*.swift"
regex: '\/\/\s*MARK:[^\n]*(\n)(?!\n)|(\n\n\n)[ \t]*\/\/\s*MARK:|[^\s{]\n[^\n\/]*\/\/\s*MARK:'
name: "Vertical Whitespaces Around MARK:"
message: "Include a single vertical whitespace (empty line) before and after MARK: comments."
vertical_whitespace_closing_braces:
included: ".*.swift"
regex: '\n[ \t]*\n[ \t]*[)}\]]'
name: "Vertical Whitespace before Closing Braces"
message: "Don't include vertical whitespace (empty line) before closing braces."
severity: warning