-
Notifications
You must be signed in to change notification settings - Fork 61
/
.swiftlint.yml
100 lines (82 loc) · 2.49 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
# https://github.com/realm/SwiftLint/blob/master/Rules.md
# https://github.com/realm/SwiftLint
reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, junit)
disabled_rules:
- cyclomatic_complexity
- line_length
- missing_docs
- multiple_closures_with_trailing_closure
- nesting
# - shorthand_operator
# - statement_position
- todo
- type_body_length
- unused_closure_parameter
- valid_docs
- function_parameter_count
force_cast: warning
force_try:
severity: warning
unused_closure_parameter: warning
excluded:
- Carthage
- Pods
identifier_name:
allowed_symbols: "_"
min_length: 1
max_length:
warning: 50
error: 100
excluded: # excluded via string array
- _code
large_tuple:
warning: 4
error: 5
colon:
severity: error
comma: error
empty_count: error
legacy_constant: error
legacy_constructor: error
opening_brace: error
trailing_newline: error
trailing_semicolon: error
opt_in_rules:
# - empty_count
function_body_length:
warning: 225
error: 300
file_length:
warning: 500
error: 750
custom_rules:
force_https: # From https://github.com/Twigz/Game
name: "Force HTTPS over HTTP"
regex: "((?i)http(?!s))"
match_kinds: string
message: "HTTPS should be favored over HTTP"
severity: warning
double_space: # From https://github.com/IBM-Swift/Package-Builder
include: "*.swift"
name: "Double space"
regex: '([a-z,A-Z] \s+)'
message: "Double space between keywords"
match_kinds: keyword
severity: error
# multi_clause_guard:
# regex: 'guard [\h\S]*,'
explicit_failure_calls:
name: “Avoid asserting ‘false’”
regex: ‘((assert|precondition)\(false)’
message: “Use assertionFailure() or preconditionFailure() instead.”
severity: warning
# comments_capitalized_find_possible_code:
# name: "Catch Commented Out Code"
# regex: "(^ *// +(?!swiftlint)[a-z]+)"
# message: "The first word of a comment should be capitalized"
# severity: warning
unnecessary_type:
name: "Unnecessary Type"
regex: '[ a-zA-Z0-9]*(?:let|var) [ a-zA-Z0-9]*: ([a-zA-Z0-9]*)[\? ]*= \1'
message: "Type Definition Not Needed"
severity: warning