forked from mozilla-mobile/firefox-ios
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy path.swiftlint.yml
More file actions
181 lines (169 loc) · 5.02 KB
/
.swiftlint.yml
File metadata and controls
181 lines (169 loc) · 5.02 KB
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
only_rules: # Only enforce these rules, ignore all others
# Ecosia: disabled
# - line_length
- blanket_disable_command
- class_delegate_protocol
- closure_spacing
- closure_parameter_position
- colon
- comma
- comment_spacing
- compiler_protocol_init
- computed_accessors_order
- control_statement
- duplicate_conditions
- dynamic_inline
- empty_enum_arguments
- empty_parameters
- empty_parentheses_with_trailing_closure
- for_where
- force_try
- implicit_getter
- inclusive_language
- invalid_swiftlint_command
- large_tuple
- leading_whitespace
- legacy_cggeometry_functions
- legacy_constant
- legacy_constructor
- legacy_hashing
- legacy_nsgeometry_functions
- mark
- no_space_in_method_call
- ns_number_init_as_function_reference
- function_name_whitespace
- orphaned_doc_comment
- private_over_fileprivate
- protocol_property_accessors_order
- redundant_discardable_let
- redundant_objc_attribute
- implicit_optional_initialization
- redundant_string_enum_value
# Ecosia: disabled
# - redundant_void_return
- return_arrow_whitespace
- statement_position
- switch_case_alignment
- syntactic_sugar
- trailing_newline
- trailing_semicolon
- trailing_whitespace
- unavailable_condition
- unneeded_override
- unneeded_synthesized_initializer
- unused_optional_binding
- unused_setter_value
- vertical_parameter_alignment
- vertical_whitespace
- void_function_in_ternary
- void_return
- file_header
- redundant_type_annotation
# Ecosia: disabled
# - attributes
- closing_brace
- closure_end_indentation
- contains_over_filter_count
- contains_over_filter_is_empty
- contains_over_first_not_nil
- contains_over_range_nil_comparison
- empty_collection_literal
- empty_count
- empty_string
- empty_xctest_method
- explicit_init
- first_where
- discouraged_assert
- duplicate_imports
- duplicate_enum_cases
- last_where
- modifier_order
- multiline_arguments
- opening_brace
- overridden_super_call
- vertical_parameter_alignment_on_call
- vertical_whitespace_closing_braces
# Ecosia: disabled
# - vertical_whitespace_opening_braces
- yoda_condition
- accessibility_label_for_image
- accessibility_trait_for_button
# Ecosia: enabled
- custom_rules
# These rules were originally opted into. Disabling for now to get
# Swiftlint up and running.
# - deployment_target
# - discouraged_optional_collection
# - prohibited_interface_builder
# - prohibited_super_call
# - protocol_property_accessors_order
line_length:
warning: 125
ignores_urls: true
ignores_interpolated_strings: true
custom_rules:
reassign_analytics_instance:
included:
- ".*\\.swift"
excluded:
- "EcosiaTests/*"
regex: "(Analytics.shared =)"
capture_group: 0
match_kinds:
- comment
- identifier
message: "We should not re-assign Analytics shared instance outside tests."
severity: error
no_hiding_in_strings:
regex: "(Analytics.shared =)"
match_kinds: string
file_header:
required_string: |
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/
analyzer_rules: # Rules run by `swiftlint analyze`
- unused_import
excluded: # paths to ignore during linting. Takes precedence over `included`.
# Firefox specific
- build/
- .build/
- firefox-ios/Client/Assets/Search/get_supported_locales.swift
- firefox-ios/Client/Generated
# Ecosia: Include persisted generated
- firefox-ios/Client/Ecosia/PersistedGenerated
- firefox-ios/fastlane/
- firefox-ios/FxA
- firefox-ios/FxAClient
- firefox-ios/Source/ExcludedFolder
- firefox-ios/Source/ExcludedFile.swift
- firefox-ios/Storage/ThirdParty/SwiftData.swift
- firefox-ios/Sync/Generated/Metrics.swift
- firefox-ios/Storage/Generated/Metrics.swift
- firefox-ios/ThirdParty
- test-fixtures/tmp
- firefox-ios/firefox-ios-tests/Tests/UITests/
- l10n-screenshots-dd/
- DerivedData/
# Package.swift files need a custom header for swift-tools-version
# so must be excluded due to file_header rule
- firefox-ios/Package.swift
- BrowserKit/Package.swift
- BrowserKit/.build/
- firefox-ios/Client/ContentBlocker/ContentBlockerGenerator/Package.swift
- Package.swift
- firefox-ios/Build/Intermediates.noindex/Client.build/Fennec-iphoneos/WidgetKitExtension.build/DerivedSources/IntentDefinitionGenerated/WidgetIntents/*
# Temporarly ignore focus-ios folder
- focus-ios/
# Ecosia: Exclude Swift Packages
- firefox-ios/SourcePackages
# Ecosia: Remove Metrics.swift as part of Glean
- Storage/Generated/Metrics.swift
# Ecosia: Exclude Tuist-generated bundle files
- firefox-ios/Derived/Sources
included:
- /Users/vagrant/git
- .
# reporter: "json" # reporter type (xcode, json, csv, checkstyle)
reporter: "xcode" # reporter type (xcode, json, csv, checkstyle)
baseline: swiftlint_baseline.json