-
Notifications
You must be signed in to change notification settings - Fork 0
/
.swiftlint.yml
93 lines (93 loc) · 5.81 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
disabled_rules: # rule identifiers to exclude from running
# - colon
# - comma
# - control_statement
# - file_length
# - force_cast
# - force_try
# - function_body_length
# - leading_whitespace
# - line_length
# - nesting
# - operator_whitespace
# - opening_brace
# - return_arrow_whitespace
# - statement_position
# - todo
# - trailing_newline
# - trailing_semicolon
# - trailing_whitespace
# - type_body_length
# - type_name
# - valid_docs
# - variable_name
# - variable_name_min_length
# - variable_name_max_length
opt_in_rules:
- array_init # Prefer using Array(seq) over seq.map { $0 } to convert a sequence into an Array.
- attributes # Attributes should be on their own lines in functions and types, but on the same line as variables and imports.
- 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.
- contains_over_filter_count # Prefer contains over comparing filter(where:).count to 0.
- contains_over_filter_is_empty # Prefer contains over using filter(where:).isEmpty.
- contains_over_first_not_nil # Prefer contains over first(where:) != nil and firstIndex(where:) != nil
- contains_over_range_nil_comparison # Prefer contains over range(of:) != nil and range(of:) == nil.
- convenience_type # Types used for hosting only static members should be implemented as a caseless enum to avoid instantiation.
- empty_collection_literal # Prefer checking isEmpty over comparing collection to an empty array or dictionary literal.
- empty_count # Prefer checking isEmpty over comparing count to zero.
- empty_string # Prefer checking isEmpty over comparing string to an empty string literal.
# - explicit_enum_raw_value # Enums should be explicitly assigned their raw values.
- explicit_init # Explicitly calling .init() should be avoided.
- fatal_error_message # A fatalError call should have a message.
- first_where # Prefer using .first(where:) over .filter { }.first in collections.
- for_where # where clauses are preferred over a single if inside a for.
- function_default_parameter_at_end # Prefer to locate parameters with defaults toward the end of the parameter list.
- identical_operands # Comparing two identical operands is likely a mistake.
- implicit_return # Prefer implicit returns in closures.
- last_where # Prefer using .last(where:) over .filter { }.last in collections.
- legacy_multiple # Prefer using the isMultiple(of:) function instead of using the remainder operator (%).
- 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.
# - missing_docs # Declarations should be documented.
- modifier_order # Modifier order should be consistent.
- multiline_arguments # Arguments should be either on the same line, or one per line.
- multiline_arguments_brackets # Multiline arguments should have their surrounding brackets in a new line.
- multiline_function_chains # Chained function calls should be either on the same line, or one per line.
- multiline_literal_brackets # Multiline literals should have their surrounding brackets in a new line.
- multiline_parameters # Functions and methods parameters should be either on the same line, or one per line.
- multiline_parameters_brackets # Multiline parameters should have their surrounding brackets in a new line.
- nslocalizedstring_key # Static strings should be used as key in NSLocalizedString in order to genstrings work.
- number_separator # Underscores should be used as thousand separator in large decimal numbers.
- operator_usage_whitespace # Operators should be surrounded by a single whitespace when they are being used.
- overridden_super_call # Some overridden methods should always call super.
- pattern_matching_keywords # Combine multiple pattern matching bindings by moving keywords out of tuples.
- reduce_into # Prefer reduce(into:_:) over reduce(_:_:) for copy-on-write types.
- redundant_nil_coalescing # nil coalescing operator is only evaluated if the lhs is nil, coalescing operator with nil as rhs is redundant.
- redundant_type_annotation # Variables should not have redundant type annotation.
- sorted_first_last # Prefer using min() or max() over sorted().first or sorted().last
- strict_fileprivate # fileprivate should be avoided.
- syntactic_sugar # Shorthand syntactic sugar should be used, i.e. [Int] instead of Array.
- 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.
- vertical_parameter_alignment_on_call # Function parameters should be aligned vertically if they're in multiple lines in a method call.
- vertical_whitespace_closing_braces # Don't include vertical whitespace (empty line) before closing braces.
- vertical_whitespace_opening_braces # Don't include vertical whitespace (empty line) after opening braces.
excluded: # paths to ignore during linting. overridden by `included`.
- Carthage
- Pods
- fastlane
- XcodeFileTemplates # Because template repo contains Xcode templates as well
- XcodeProjectTemplates # Because template repo contains Xcode templates as well
# parameterized rules are first parameterized as a warning level, then error level.
function_body_length:
- 150 # warning
- 200 # error
type_body_length:
- 300 # warning
- 400 # error
identifier_name:
excluded:
- id