forked from Carthage/Carthage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.swiftlint.yml
102 lines (93 loc) · 3.19 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
opt_in_rules:
- attributes
- closure_end_indentation
- closure_spacing
- empty_count
- explicit_init
- fatal_error_message
- file_header
- first_where
- implicitly_unwrapped_optional
- no_extension_access_modifier
- number_separator
- operator_usage_whitespace
- redundant_nil_coalescing
- switch_case_on_newline
- unneeded_parentheses_in_closure_argument
disabled_rules:
- closure_end_indentation
- function_parameter_count
- identifier_name
- no_fallthrough_only # https://github.com/realm/SwiftLint/issues/2276
- redundant_string_enum_value
- superfluous_disable_command
included:
- Source
excluded:
- Carthage
line_length:
warning: 160
ignores_comments: true
ignores_function_declarations: true
file_length:
ignore_comment_only_lines: true
file_header:
required_pattern: ''
function_body_length:
warning: 60
trailing_comma:
mandatory_comma: true
custom_rules:
if_as_guard:
included: ".*\\.swift"
regex: '\n *if [^\{]+\{\s*(?:return|break|continue)[^\n]*\n *\}(?! *else)'
name: "If as Guard"
message: "Don't use an if statement to just return/break/continue – use guard for such cases instead."
severity: warning
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
space_before_comment:
included: ".*\\.swift"
regex: '\n[ ]{0}[^\/ \n][^\n]*\n[ ]{0}\/\/|\n[ ]{4}[^\/ \n][^\n]*\n[ ]{4}\/\/|\n[ ]{8}[^\/ \n][^\n]*\n[ ]{8}\/\/|\n[ ]{16}[^\/ \n][^\n]*\n[ ]{16}\/\/|\n[ ]{20}[^\/ \n][^\n]*\n[ ]{20}\/\/|\n[ ]{24}[^\/ \n][^\n]*\n[ ]{24}\/\/'
name: "Space Before Comment"
message: "Always put a space line before a comment line and always comment code beforehand."
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."
whitespace_comment_start:
included: ".*\\.swift"
regex: '[^:#][^:#]\/\/[^\s\/]'
name: "Whitespace Comment Start"
message: "A comment should always start with a whitespace."
severity: warning
carthage_typo:
included: ".*\\.(swift|md)"
regex: "(Carhage|Cartage)"
name: "Carthage Typo"
message: "Found a possible Carthage typo"
severity: warning