Skip to content

Commit 6b98e2a

Browse files
committed
Revert "multiline_parameters: add optional checks for function call arguments"
This reverts commit 8448a17.
1 parent c0bc848 commit 6b98e2a

File tree

4 files changed

+2
-81
lines changed

4 files changed

+2
-81
lines changed

Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/MultilineParametersConfiguration.swift

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,9 @@ struct MultilineParametersConfiguration: SeverityBasedRuleConfiguration {
1010
private(set) var allowsSingleLine = true
1111
@ConfigurationElement(key: "max_number_of_single_line_parameters")
1212
private(set) var maxNumberOfSingleLineParameters: Int?
13-
@ConfigurationElement(key: "check_calls")
14-
private(set) var checkCalls = false
1513

1614
// swiftlint:disable:next unneeded_throws_rethrows
1715
func validate() throws(Issue) {
18-
if checkCalls, maxNumberOfSingleLineParameters == nil {
19-
Issue.inconsistentConfiguration(
20-
ruleID: Parent.identifier,
21-
message: """
22-
Option '\($checkCalls.key)' has no effect when \
23-
'\($maxNumberOfSingleLineParameters.key)' is nil.
24-
"""
25-
).print()
26-
}
2716
guard let maxNumberOfSingleLineParameters else {
2817
return
2918
}
@@ -44,15 +33,5 @@ struct MultilineParametersConfiguration: SeverityBasedRuleConfiguration {
4433
"""
4534
).print()
4635
}
47-
48-
if checkCalls, !allowsSingleLine {
49-
Issue.inconsistentConfiguration(
50-
ruleID: Parent.identifier,
51-
message: """
52-
Option '\($checkCalls.key)' has no effect when \
53-
'\($allowsSingleLine.key)' is false.
54-
"""
55-
).print()
56-
}
5736
}
5837
}

Source/SwiftLintBuiltInRules/Rules/Style/MultilineParametersRule.swift

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ struct MultilineParametersRule: Rule {
77
static let description = RuleDescription(
88
identifier: "multiline_parameters",
99
name: "Multiline Parameters",
10-
description: """
11-
Functions, initializers, and function call arguments should be either on the same line, or one per line
12-
""",
10+
description: "Functions and methods parameters should be either on the same line, or one per line",
1311
kind: .style,
1412
nonTriggeringExamples: MultilineParametersRuleExamples.nonTriggeringExamples,
1513
triggeringExamples: MultilineParametersRuleExamples.triggeringExamples
@@ -30,28 +28,8 @@ private extension MultilineParametersRule {
3028
}
3129
}
3230

33-
override func visitPost(_ node: FunctionCallExprSyntax) {
34-
guard node.arguments.isNotEmpty else { return }
35-
guard configuration.checkCalls else { return }
36-
guard node.trailingClosure == nil else { return }
37-
38-
if containsViolation(for: node.arguments) {
39-
let anchor = node.calledExpression.positionAfterSkippingLeadingTrivia
40-
violations.append(anchor)
41-
}
42-
}
43-
4431
private func containsViolation(for signature: FunctionSignatureSyntax) -> Bool {
4532
let parameterPositions = signature.parameterClause.parameters.map(\.positionAfterSkippingLeadingTrivia)
46-
return containsViolation(parameterPositions: parameterPositions)
47-
}
48-
49-
private func containsViolation(for arguments: LabeledExprListSyntax) -> Bool {
50-
let argumentPositions = arguments.map(\.positionAfterSkippingLeadingTrivia)
51-
return containsViolation(parameterPositions: argumentPositions)
52-
}
53-
54-
private func containsViolation(parameterPositions: [AbsolutePosition]) -> Bool {
5533
guard parameterPositions.isNotEmpty else {
5634
return false
5735
}

Source/SwiftLintBuiltInRules/Rules/Style/MultilineParametersRuleExamples.swift

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -213,20 +213,6 @@ internal struct MultilineParametersRuleExamples {
213213
param3: [String]
214214
) { }
215215
""", configuration: ["max_number_of_single_line_parameters": 2]),
216-
Example("""
217-
foo(
218-
param1: "param1",
219-
param2: false,
220-
param3: []
221-
)
222-
""", configuration: ["max_number_of_single_line_parameters": 2]),
223-
Example("""
224-
foo(param1: 1,
225-
param2: false,
226-
param3: [])
227-
""", configuration: ["max_number_of_single_line_parameters": 1]),
228-
Example("foo(param1: 1, param2: false)",
229-
configuration: ["max_number_of_single_line_parameters": 2]),
230216
]
231217

232218
static let triggeringExamples: [Example] = [
@@ -374,27 +360,6 @@ internal struct MultilineParametersRuleExamples {
374360
""", configuration: ["max_number_of_single_line_parameters": 3]),
375361
Example("""
376362
func ↓foo(param1: Int, param2: Bool, param3: [String]) { }
377-
""", configuration: [
378-
"max_number_of_single_line_parameters": 2,
379-
"check_calls": true,
380-
]),
381-
Example("↓foo(param1: 1, param2: false, param3: [])",
382-
configuration: [
383-
"max_number_of_single_line_parameters": 2,
384-
"check_calls": true,
385-
]),
386-
Example("""
387-
func ↓foo(param1: Int,
388-
param2: Bool, param3: [String]) { }
389-
""", configuration: [
390-
"max_number_of_single_line_parameters": 3,
391-
"check_calls": true,
392-
]),
393-
Example("""
394-
↓foo(param1: Int, param2: Bool, param3: [String])
395-
""", configuration: [
396-
"max_number_of_single_line_parameters": 2,
397-
"check_calls": true,
398-
]),
363+
""", configuration: ["max_number_of_single_line_parameters": 2]),
399364
]
400365
}

Tests/IntegrationTests/default_rule_configurations.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,6 @@ multiline_literal_brackets:
697697
multiline_parameters:
698698
severity: warning
699699
allows_single_line: true
700-
check_calls: false
701700
meta:
702701
opt-in: true
703702
correctable: false

0 commit comments

Comments
 (0)