forked from ridi/WKJavaScriptController
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.swiftlint.yml
93 lines (82 loc) · 4.48 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
# refs: https://github.com/realm/SwiftLint/blob/master/Rules.md
reporter: "xcode"
included:
- Sources
- Demo
excluded:
- Demo/Pods
disabled_rules:
- block_based_kvo # Prefer the new block based KVO API with keypaths when using Swift 3.2 or later.
- cyclomatic_complexity # Complexity of function bodies should be limited.
- file_length # Files should not span too many lines.
- for_where # where clauses are preferred over a single if inside a for.
- force_cast # Force casts should be avoided.
- force_try # Force tries should be avoided.
- function_body_length # Functions bodies should not span too many lines.
- line_length # Lines should not span too many characters.
- todo # TODOs and FIXMEs should be resolved.
- trailing_whitespace # Lines should not have trailing whitespace.
- unused_setter_value # Setter value is not used.
opt_in_rules:
- anyobject_protocol # Prefer using AnyObject over class for class-only protocols.
- array_init # Prefer using Array(seq) over seq.map { $0 } to convert a sequence into an Array.
- closure_end_indentation # Closure end should have the same indentation as the line that started it.
- closure_spacing # Closure expressions should have a single space inside each brace.
- collection_alignment # All elements in a collection literal should be vertically aligned
- conditional_returns_on_newline # Conditional statements should always return on the next line.
- discouraged_object_literal # Prefer initializers over object literals.
- empty_count # Prefer checking isEmpty over comparing count to zero.
- empty_string # Prefer checking isEmpty over comparing string to an empty string literal.
- empty_xctest_method # Empty XCTest method should be avoided.
- explicit_init # Explicitly calling .init() should be avoided.
- extension_access_modifier # Prefer to use extension access modifiers.
- fallthrough # Fallthrough should be avoided.
- fatal_error_message # A fatalError call should have a message.
- file_header # Header comments should be consistent with project patterns.
- first_where # Prefer using .first(where:) over .filter { }.first in collections.
- function_default_parameter_at_end # Prefer to locate parameters with defaults toward the end of the parameter list.
- joined_default_parameter # Discouraged explicit usage of the default. separator.
- last_where # Prefer using .last(where:) over .filter { }.last in collections.
- legacy_random # Prefer using type.random(in:) over legacy functions.
- literal_expression_end_indentation # Array and dictionary literal end should have the same indentation as the line that started it.
- lower_acl_than_parent # Ensure definitions have a lower access control level than their enclosing parent.
- multiline_literal_brackets # Multiline literals should have their surrounding brackets in a new line.
- prohibited_super_call # Some methods should not call super.
- sorted_imports # Imports should be sorted.
- toggle_bool # Prefer someBool.toggle() over someBool = !someBool.
- unneeded_parentheses_in_closure_argument # Parentheses are not needed when declaring closure arguments.
- unused_import # All imported modules should be required to make the file compile.
- unused_private_declaration # Private declarations should be referenced in that file.
- vertical_parameter_alignment_on_call # Function parameters should be aligned vertically if they're in multiple lines in a method call.
function_parameter_count:
warning: 11
error: 11
# Identifier names should only contain alphanumeric characters and start with a lowercase character or should only contain capital letters.
# In an exception to the above, variable names may start with a capital letter when they are declared static and immutable. Variable names should not be too long or too short.
identifier_name:
allowed_symbols: ['_']
max_length:
warning: 50
error: 50
min_length:
warning: 1
error: 1
validates_start_with_lowercase: false
# Types should be nested at most 2 level deep, and statements should be nested at most 5 levels deep.
nesting:
type_level:
warning: 2
error: 2
# Type bodies should not span too many lines.
type_body_length:
warning: 1100
error: 1100
# Type name should only contain alphanumeric characters, start with an uppercase character and span between 3 and 50 characters in length.
type_name:
allowed_symbols: ['_']
max_length:
warning: 50
error: 50
# Limit vertical whitespace to a single empty line.
vertical_whitespace:
max_empty_lines: 2