Skip to content

Commit 5843494

Browse files
committed
Fix warnings
1 parent 6b98e2a commit 5843494

File tree

49 files changed

+579
-235
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+579
-235
lines changed

Source/SwiftLintBuiltInRules/Rules/Idiomatic/DiscouragedOptionalCollectionExamples.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,5 +218,7 @@ private func wrapExample(_ type: String,
218218
\(type) Foo {
219219
\(test)
220220
}
221-
""", file: file, line: line)
221+
""",
222+
file: file,
223+
line: line)
222224
}

Source/SwiftLintBuiltInRules/Rules/Idiomatic/ImplicitlyUnwrappedOptionalRule.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ struct ImplicitlyUnwrappedOptionalRule: Rule {
2121
@IBOutlet
2222
weak var bar: SomeObject!
2323
}
24-
""", configuration: ["mode": "all_except_iboutlets"], excludeFromDocumentation: true),
24+
""",
25+
configuration: ["mode": "all_except_iboutlets"],
26+
excludeFromDocumentation: true
27+
),
2528
],
2629
triggeringExamples: [
2730
Example("let label: ↓UILabel!"),

Source/SwiftLintBuiltInRules/Rules/Idiomatic/TypeNameRule.swift

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,21 @@ struct TypeNameRule: Rule {
2222
private extension TypeNameRule {
2323
final class Visitor: ViolationsSyntaxVisitor<ConfigurationType> {
2424
override func visitPost(_ node: StructDeclSyntax) {
25-
if let violation = violation(identifier: node.name, modifiers: node.modifiers,
26-
inheritedTypes: node.inheritanceClause?.inheritedTypes) {
25+
if let violation = violation(
26+
identifier: node.name,
27+
modifiers: node.modifiers,
28+
inheritedTypes: node.inheritanceClause?.inheritedTypes
29+
) {
2730
violations.append(violation)
2831
}
2932
}
3033

3134
override func visitPost(_ node: ClassDeclSyntax) {
32-
if let violation = violation(identifier: node.name, modifiers: node.modifiers,
33-
inheritedTypes: node.inheritanceClause?.inheritedTypes) {
35+
if let violation = violation(
36+
identifier: node.name,
37+
modifiers: node.modifiers,
38+
inheritedTypes: node.inheritanceClause?.inheritedTypes
39+
) {
3440
violations.append(violation)
3541
}
3642
}
@@ -42,30 +48,42 @@ private extension TypeNameRule {
4248
}
4349

4450
override func visitPost(_ node: AssociatedTypeDeclSyntax) {
45-
if let violation = violation(identifier: node.name, modifiers: node.modifiers,
46-
inheritedTypes: node.inheritanceClause?.inheritedTypes) {
51+
if let violation = violation(
52+
identifier: node.name,
53+
modifiers: node.modifiers,
54+
inheritedTypes: node.inheritanceClause?.inheritedTypes
55+
) {
4756
violations.append(violation)
4857
}
4958
}
5059

5160
override func visitPost(_ node: EnumDeclSyntax) {
52-
if let violation = violation(identifier: node.name, modifiers: node.modifiers,
53-
inheritedTypes: node.inheritanceClause?.inheritedTypes) {
61+
if let violation = violation(
62+
identifier: node.name,
63+
modifiers: node.modifiers,
64+
inheritedTypes: node.inheritanceClause?.inheritedTypes
65+
) {
5466
violations.append(violation)
5567
}
5668
}
5769

5870
override func visitPost(_ node: ActorDeclSyntax) {
59-
if let violation = violation(identifier: node.name, modifiers: node.modifiers,
60-
inheritedTypes: node.inheritanceClause?.inheritedTypes) {
71+
if let violation = violation(
72+
identifier: node.name,
73+
modifiers: node.modifiers,
74+
inheritedTypes: node.inheritanceClause?.inheritedTypes
75+
) {
6176
violations.append(violation)
6277
}
6378
}
6479

6580
override func visitPost(_ node: ProtocolDeclSyntax) {
6681
if configuration.validateProtocols,
67-
let violation = violation(identifier: node.name, modifiers: node.modifiers,
68-
inheritedTypes: node.inheritanceClause?.inheritedTypes) {
82+
let violation = violation(
83+
identifier: node.name,
84+
modifiers: node.modifiers,
85+
inheritedTypes: node.inheritanceClause?.inheritedTypes
86+
) {
6987
violations.append(violation)
7088
}
7189
}

Source/SwiftLintBuiltInRules/Rules/Idiomatic/UnneededBreakInSwitchRule.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ private func embedInSwitch(
1111
\(`case`):
1212
\(text)
1313
}
14-
""", file: file, line: line)
14+
""",
15+
file: file,
16+
line: line)
1517
}
1618

1719
@SwiftSyntaxRule(explicitRewriter: true)

Source/SwiftLintBuiltInRules/Rules/Lint/DeploymentTargetRule.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,11 @@ private extension DeploymentTargetRule {
8686
for elem in node.availabilityArguments {
8787
guard let restriction = elem.argument.as(PlatformVersionSyntax.self),
8888
let versionString = restriction.version?.description,
89-
let reason = reason(platform: restriction.platform, version: versionString,
90-
violationType: violationType) else {
89+
let reason = reason(
90+
platform: restriction.platform,
91+
version: versionString,
92+
violationType: violationType
93+
) else {
9194
continue
9295
}
9396

Source/SwiftLintBuiltInRules/Rules/Lint/PrivateOutletRule.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ struct PrivateOutletRule: Rule {
7373
ellipsisButtonDidTouch?(self)
7474
}
7575
}
76-
""", configuration: ["allow_private_set": false], excludeFromDocumentation: true),
76+
""",
77+
configuration: ["allow_private_set": false],
78+
excludeFromDocumentation: true),
7779
]
7880
)
7981
}

Source/SwiftLintBuiltInRules/Rules/Lint/ProhibitedInterfaceBuilderRule.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,7 @@ private func wrapExample(_ text: String, file: StaticString = #filePath, line: U
4141
class ViewController: UIViewController {
4242
\(text)
4343
}
44-
""", file: file, line: line)
44+
""",
45+
file: file,
46+
line: line)
4547
}

Source/SwiftLintBuiltInRules/Rules/Lint/StrongIBOutletRule.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,7 @@ private func wrapExample(_ text: String, file: StaticString = #filePath, line: U
7272
class ViewController: UIViewController {
7373
\(text)
7474
}
75-
""", file: file, line: line)
75+
""",
76+
file: file,
77+
line: line)
7678
}

Source/SwiftLintBuiltInRules/Rules/Lint/UnusedDeclarationRule.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,12 @@ private extension SwiftLintFile {
111111
compilerArguments: [String],
112112
configuration: UnusedDeclarationConfiguration) -> Set<UnusedDeclarationRule.DeclaredUSR> {
113113
Set(index.traverseEntitiesDepthFirst { _, indexEntity in
114-
self.declaredUSR(indexEntity: indexEntity, editorOpen: editorOpen, compilerArguments: compilerArguments,
115-
configuration: configuration)
114+
self.declaredUSR(
115+
indexEntity: indexEntity,
116+
editorOpen: editorOpen,
117+
compilerArguments: compilerArguments,
118+
configuration: configuration
119+
)
116120
})
117121
}
118122

Source/SwiftLintBuiltInRules/Rules/Lint/UnusedImportRuleExamples.swift

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,18 @@ struct UnusedImportRuleExamples {
182182
import Foundation
183183
typealias Foo = CFArray
184184
dispatchMain()
185-
""", configuration: [
186-
"require_explicit_imports": true,
187-
"allowed_transitive_imports": [
188-
[
189-
"module": "Foundation",
190-
"allowed_transitive_imports": ["CoreFoundation", "Dispatch"],
185+
""",
186+
configuration: [
187+
"require_explicit_imports": true,
188+
"allowed_transitive_imports": [
189+
[
190+
"module": "Foundation",
191+
"allowed_transitive_imports": ["CoreFoundation", "Dispatch"],
192+
] as [String: any Sendable],
193+
],
191194
] as [String: any Sendable],
192-
],
193-
] as [String: any Sendable], testMultiByteOffsets: false, testOnLinux: false):
195+
testMultiByteOffsets: false,
196+
testOnLinux: false):
194197
Example("""
195198
import Foundation
196199
typealias Foo = CFArray
@@ -200,9 +203,12 @@ struct UnusedImportRuleExamples {
200203
↓↓↓import Foundation
201204
typealias Foo = CFData
202205
dispatchMain()
203-
""", configuration: [
204-
"require_explicit_imports": true
205-
], testMultiByteOffsets: false, testOnLinux: false):
206+
""",
207+
configuration: [
208+
"require_explicit_imports": true
209+
],
210+
testMultiByteOffsets: false,
211+
testOnLinux: false):
206212
Example("""
207213
import CoreFoundation
208214
import Dispatch
@@ -234,9 +240,12 @@ struct UnusedImportRuleExamples {
234240
typealias Bar = CFData
235241
@objc
236242
class A {}
237-
""", configuration: [
238-
"require_explicit_imports": true
239-
], testMultiByteOffsets: false, testOnLinux: false):
243+
""",
244+
configuration: [
245+
"require_explicit_imports": true
246+
],
247+
testMultiByteOffsets: false,
248+
testOnLinux: false):
240249
Example("""
241250
import CoreFoundation
242251
import Foundation

0 commit comments

Comments
 (0)