-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.swiftlint.yml
89 lines (88 loc) · 7.83 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
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.
- attributes # Attributes should be on their own lines in functions and types, but on the same line as variables and imports.
- closure_body_length # Closure bodies should not span too many lines.
- closure_end_indentation # Closure end should have the same indentation as the line that started it.
- closure_parameter_position # Closure parameters should be on the same line as opening brace.
- 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
- contains_over_filter_count # Prefer `contains` over comparing `filter(where:).count` to `0`.
- 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.
- discouraged_direct_init # Discouraged direct initialization of types that can be harmful.
- discouraged_object_literal # Prefer initializers over object literals.
- discouraged_optional_boolean # Prefer non-optional booleans over optional booleans.
- discouraged_optional_collection # Prefer empty collection over optional collection.
- 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_acl # All declarations should specify Access Control Level keywords explicitly.
- explicit_init # Explicitly calling .init() should be avoided.
- explicit_self # Instance variables and functions should be explicitly accessed with `self.`.
- explicit_top_level_acl # Top-level declarations should specify Access Control Level keywords explicitly.
- explicit_type_interface # Properties should have a type interface
- fatal_error_message # A fatalError call should have a message.
- file_header # Header comments should be consistent with project patterns.
- file_name # File name should match a type or extension declared in the file (if any).
- first_where # Prefer using `.first(where:)` over `.filter { }.first` in collections.
- flatmap_over_map_reduce # Prefer `flatMap` over `map` followed by `reduce([], +)`.
- force_unwrapping # Force unwrapping should be avoided.
- identical_operands # Comparing two identical operands is likely a mistake.
- implicit_return # Prefer implicit returns in closures, functions and getters.
- implicitly_unwrapped_optional # Implicitly unwrapped optionals should be avoided when possible.
- is_disjoint # Prefer using `Set.isDisjoint(with:)` over `Set.intersection(_:).isEmpty`.
- joined_default_parameter # Discouraged explicit usage of the default separator.
- 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
- let_var_whitespace # Let and var should be separated from other statements by a blank line.
- 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
- modifier_order # Modifier order should be consistent.
- multiline_arguments # Arguments should be either on the same line, or one per 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.
- nimble_operator # Prefer Nimble operator overloads over free matcher functions.
- 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.
- object_literal # Prefer object literals over image and color inits.
- 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
- prefer_self_type_over_type_of_self # Prefer `Self` over `type(of: self)` when accessing properties or calling methods.
- prefer_zero_over_explicit_init # Prefer `.zero` over explicit init with zero parameters (e.g. `CGPoint(x: 0, y: 0)`)
- quick_discouraged_focused_test # Discouraged focused test. Other tests won’t run while this one is focused.
- quick_discouraged_pending_test # Discouraged pending test. This test won’t run while it’s marked as pending.
- redundant_nil_coalescing # nil coalescing operator is only evaluated if the lhs is nil, coalescing operator with nil as rhs is redundant
- redundant_set_access_control # Property setter access level shouldn’t be explicit if it’s the same as the variable access level.
- redundant_type_annotation # Variables should not have redundant type annotation
- redundant_void_return # Returning Void in a function declaration is redundant.
- single_test_class # Test files should contain a single QuickSpec or XCTestCase class.
- sorted_first_last # Prefer using min() or max() over sorted().first or sorted().last
- sorted_imports # Imports should be sorted.
- statement_position # Else and catch should be on the same line, one space after the previous declaration.
- static_operator # Operators should be declared as static functions, not free functions.
- switch_case_alignment # Case statements should vertically align with their enclosing switch statement, or indented if configured otherwise.
- syntactic_sugar # Shorthand syntactic sugar should be used, i.e. [Int] instead of Array.
- toggle_bool # Prefer `someBool.toggle()` over `someBool = !someBool`.
- trailing_closure # Trailing closure syntax should be used whenever possible.
- unavailable_function # Unimplemented functions should be marked as unavailable.
- unneeded_parentheses_in_closure_argument # Parentheses are not needed when declaring closure arguments.
- unowned_variable_capture # Prefer capturing references as weak to avoid potential crashes.
- untyped_error_in_catch # Catch statements should not declare error variables without type casting.
- unused_control_flow_label # Unused control flow label should be removed.
- unused_declaration # Declarations should be referenced at least once within all files linted.
- unused_import # All imported modules should be required to make the file compile.
- unused_setter_value # Setter value is not used.
- vertical_parameter_alignment # Function parameters should be aligned vertically if they’re in multiple lines in a declaration.
- vertical_parameter_alignment_on_call # function parameters should be aligned vertically if they’re in multiple lines in a method call.
- void_return # Prefer `-> Void` over `-> ()`
- weak_delegate # Delegates should be weak to avoid reference cycles
- yoda_condition # Variable should be placed left of comparison operator
included: # paths to include during linting. `--path` is ignored if present.
- Sources
excluded: # paths to ignore during linting. Takes precedence over `included`.
- vendor
reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, junit, html, emoji)