-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add max number if params allowed for multiline_parameters
#5781
base: main
Are you sure you want to change the base?
Conversation
e7d445b
to
48c7fb4
Compare
Here's an example of your CHANGELOG entry: * Add max number if params allowed for `multiline_parameters`.
[kimdv](https://github.com/kimdv)
[#issue_number](https://github.com/realm/SwiftLint/issues/issue_number) note: There are two invisible spaces after the entry's text. Generated by 🚫 Danger |
Source/SwiftLintBuiltInRules/Rules/Style/MultilineParametersRuleExamples.swift
Show resolved
Hide resolved
Source/SwiftLintBuiltInRules/Rules/Style/MultilineParametersRule.swift
Outdated
Show resolved
Hide resolved
8fedd68
to
064dade
Compare
98e3679
to
d3d8886
Compare
f724f3a
to
c858669
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mechanism seems to work. 👍
Let's have a separate test verifying that these issues are thrown. You can intercept the console output with the help of Issue.captureConsole { ... }
.
Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/MultilineParametersConfiguration.swift
Outdated
Show resolved
Hide resolved
c858669
to
5cb3560
Compare
I've tried to make some tests, but I can't seem to get it work as you suggest. I get this
I'm considering to do something like XCTAssertThrowsError(try config.apply(configuration: ["max_number_of_single_line_parameters": 2, "allows_single_line": false])) { error in
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good. Thanks for the updates and for adding tests!
This PR will configuration option for
multiline_parameters
so it's allowed to have like two params on the same line.