forked from eu-digital-green-certificates/json-logic-swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.swiftlint.yml
158 lines (158 loc) · 4.64 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
disabled_rules: # rule identifiers to exclude from running
# - colon
# - opening_brace
# - comma
# - trailing_comma
# - force_cast
# - type_name
- nesting
# - trailing_semicolon
# - function_body_length
# - nesting
# - conditional_binding_cascade
# - operator_whitespace
# - control_statement
# - legacy_constant
# - line_length
# - return_arrow_whitespace
# - trailing_whitespace
# - closing_brace
# - statement_position
# - type_body_length
# - function_parameter_count
# - todo
# - legacy_constructor
# - valid_docs
# - missing_docs
# - file_length
# - leading_whitespace
# - trailing_newline
- identifier_name
# - syntactic_sugar
# - vertical_parameter_alignment
# - void_return
# - vertical_whitespace
# - mark
# - notification_center_detachment
# - for_where
- large_tuple
# - class_delegate_protocol
# - closure_parameter_position
# - shorthand_operator
# - cyclomatic_complexity
# - implicit_getter
# - unused_optional_binding
# - unused_closure_parameter
# - redundant_void_return
# - unused_enumerated
# - redundant_discardable_let
opt_in_rules: # some rules are only opt-in
- empty_count
- anyobject_protocol
- array_init
- contains_over_first_not_nil
- empty_string
- empty_xctest_method
- convenience_type
- unused_import
- missing_docs
- untyped_error_in_catch
- first_where
# - implicit_return
# - implicitly_unwrapped_optional
- let_var_whitespace
- literal_expression_end_indentation
- multiline_arguments
- multiline_parameters
- number_separator
- operator_usage_whitespace
- pattern_matching_keywords
- sorted_first_last
# - sorted_imports
- switch_case_on_newline
# - vertical_parameter_alignment_on_call bug -> https://github.com/realm/SwiftLint/issues/2468
- yoda_condition
# Find all the available rules by running:
# swiftlint rules
included: # paths to include during linting. `--path` is ignored if present.
- Sources
- Tests
# - ProductProtype
# - PrototypeTests
# - ProductWidget
# - SDK
excluded: # paths to ignore during linting. Takes precedence over `included`.
- Carthage
- Pods
- .build
#The following are generated sources from `swift test --generate-linuxmain`
- Tests/jsonlogicTests/XCTestManifests.swift
- Tests/LinuxMain.swift
cyclomatic_complexity:
warning: 14
error: 16
empty_count:
severity: warning
force_cast:
severity: warning
force_try:
severity: warning
line_length: 100
function_body_length:
warning: 30
error: 40
type_body_length:
warning: 250
file_length:
warning: 1000
type_name:
min_length: 3
max_length: 64
identifier_name:
min_length: # only min_length
warning: 3 # only error
max_length: # only min_length
warning: 64 # only error
reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, junit, html, emoji)
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
# 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)(?:[^\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. Use () for empty statement."
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