forked from divkit/divkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.swiftlint.yml
79 lines (77 loc) · 2.79 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
only_rules:
# Can not be specified alongside disabled_rules or opt_in_rules.
# Acts as a whitelist, only the rules specified in this list will be enabled.
- closing_brace
- colon
- comma
- custom_rules
- legacy_cggeometry_functions
- legacy_constant
- legacy_constructor
- return_arrow_whitespace
- statement_position
- trailing_newline
- trailing_semicolon
- trailing_whitespace
excluded:
- "Core"
- "DivKit/generated_sources"
- "DivKit/shared_data_generated_sources"
custom_rules:
dictionary_colon:
name: "Colon should be stuck to key type"
regex: '\[[A-Za-z\d]+? : [a-zA-Z\d]+?]'
severity: error
no_direct_use_for_main_queue:
name: "Use MainQueue"
regex: 'OperationQueue\.main'
message: "Use MainQueue constant to access main queue"
severity: error
no_direct_use_of_operationqueue_init:
name: "Use specialized initializer"
regex: ' OperationQueue\(\)'
message: "Use OperationQueue(name:qos:) or OperationQueue.serialQueue(name:qos:) instead"
severity: error
no_using_decoder_parameter_name:
name: "Omit aDecoder parameter name"
regex: 'init\?\(coder (?!_:)'
message: "Use init?(coder _: NSCoder) instead"
severity: error
no_class_without_access_and_overridability:
name: "Add access or overridability keyword"
regex: '^class '
message: "If you want to make an overridable class, use explicit internal keyword."
severity: error
access_and_overridability_order:
name: "Access and overridability keywords order"
regex: '^final (public|internal|private|fileprivate) class'
message: "Access keyword should be first, final second"
severity: error
one_newline_after_import:
name: "New line after imports"
regex: "import [A-Za-z]+\n\n\n"
message: "There should be only one new line after import statements"
unsafe_cf_cast:
name: "Unsafe CF cast"
regex: '\sas(\?|!)\s((CF|CT)[A-Z][A-Za-z\d]*|CGColor)'
message: "Such a cast to CF* type is unsafe. Use Serialization.safeCFCast (or add one if missing)"
no_direct_use_of_repeating_count_initializer:
name: "Dangerous repeating initializer"
regex: '\(\s*repeating\s*:\s*\S.*,\s*count\s*:\s*\S.*\)'
message: "Use init(repeating:times:) instead"
severity: warning
no_direct_use_of_unique_keys_with_values_initializer:
name: "Dangerous dictionary initializer"
regex: '\(\s*uniqueKeysWithValues\s*:\s*\S.*\)'
message: "Use init(_:uniquingKeysWith:) instead"
severity: error
init_radix:
name: "Unsafe `init(_:radix:)`"
regex: ',\s*radix\s*:\s*\S.*(?:,\s*uppercase\s*:\s*\S.*)?\)'
message: "Use init(_:safeRadix:) instead"
severity: error
prohibited_imports:
name: "Importing prohibited module"
regex: 'import (BaseMacros)$'
message: "Importing module $1 is prohibited in Swift code"
severity: error