-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.swiftlint.yml
80 lines (74 loc) · 2.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
excluded:
- Carthage
- Pods/
- NearbyHospitalsTests/GeneratedMocks.swift
line_length:
- 300 # warning
- 400 # error
function_body_length:
- 300 # warning
- 400 # error
type_body_length:
- 300 # warning
- 400 # error
opt_in_rules:
- empty_count
- line_length
custom_rules:
rule_id:
included: Source/SwiftLintFramework/Rules/.+/\w+\.swift
name: Rule ID
message: Rule IDs must be all lowercase, snake case and not end with `rule`
regex: identifier:\s*("\w+_rule"|"\S*[^a-z_]\S*")
severity: error
fatal_error:
name: Fatal Error
excluded: "Tests/*"
message: Prefer using `queuedFatalError` over `fatalError` to avoid leaking compiler host machine paths.
regex: \bfatalError\b
match_kinds:
- identifier
severity: error
rule_test_function:
included: Tests/SwiftLintFrameworkTests/RulesTests.swift
name: Rule Test Function
message: Rule Test Function mustn't end with `rule`
regex: func\s*test\w+(r|R)ule\(\)
severity: error
# Rules to encourage usage of SwiftGen
custom_rules:
swiftgen_assets:
name: "SwiftGen Assets"
regex: '(UIImage|UIColor)(\.init)?\(named: ?"?.+"?(, ?in:.+?, ?compatibleWith:.+?)?\)|#imageLiteral\(resourceName: ?".+"\)'
message: "Use Asset.<asset> instead"
severity: error
swiftgen_colors:
name: "SwiftGen Colors"
regex: '(UIColor(\.init)?|#colorLiteral)\(((red|displayP3Red):.+?,green:.+?,blue:.+?,alpha:.+?)|(white:.+?,alpha:.+?)|(hue:.+?,saturation:.+?,brightness:.+?,alpha:.+?)\)'
message: "Use ColorName.<color> instead"
severity: error
swiftgen_fonts:
name: "SwiftGen Fonts"
regex: 'UIFont(\.init)?\(name: ?"?.+"?, ?size:.+?\)'
message: "Use FontFamily.<family>.<variant>.size(<size>) instead"
severity: error
swiftgen_storyboards:
name: "SwiftGen Storyboards"
regex: '(UIStoryboard\(name: ?"?.+"?, ?bundle:.+\))|(instantiateViewController\(withIdentifier:.+?\))|(instantiateInitialViewController\(\))'
message: "Use StoryboardScene.<storyboad>.<scene>.instantiate() instead"
severity: error
swiftgen_storyboard_segue_perform:
name: "SwiftGen Storyboard Segue Identifier"
regex: 'performSegue\(withIdentifier: ?"?.+"?, ?sender:.+\)'
message: "Use perform(segue: StoryboardSegue.<storyboard>.<segue>, sender: <sender>) instead"
severity: error
swiftgen_storyboard_segue_prepare:
name: "SwiftGen Storyboard Segue Prepare"
regex: 'segue.identifier'
message: "Use StoryboardSegue.<storyboard>(segue) instead"
severity: error
swiftgen_strings:
name: "SwiftGen Strings"
regex: 'NSLocalizedString'
message: "Use L10n.key instead"
severity: error