SwiftLint
SwiftLint copied to clipboard
Add max number if params allowed for `multiline_parameters`
This PR will configuration option for multiline_parameters so it's allowed to have like two params on the same line.
| 17 Messages | |
|---|---|
| :book: | Linting Aerial with this PR took 0.92s vs 0.93s on main (1% faster) |
| :book: | Linting Alamofire with this PR took 1.26s vs 1.27s on main (0% faster) |
| :book: | Linting Brave with this PR took 7.2s vs 7.21s on main (0% faster) |
| :book: | Linting DuckDuckGo with this PR took 5.12s vs 5.16s on main (0% faster) |
| :book: | Linting Firefox with this PR took 10.71s vs 10.73s on main (0% faster) |
| :book: | Linting Kickstarter with this PR took 9.89s vs 10.0s on main (1% faster) |
| :book: | Linting Moya with this PR took 0.53s vs 0.54s on main (1% faster) |
| :book: | Linting NetNewsWire with this PR took 2.9s vs 2.92s on main (0% faster) |
| :book: | Linting Nimble with this PR took 0.78s vs 0.79s on main (1% faster) |
| :book: | Linting PocketCasts with this PR took 8.5s vs 8.53s on main (0% faster) |
| :book: | Linting Quick with this PR took 0.46s vs 0.47s on main (2% faster) |
| :book: | Linting Realm with this PR took 4.48s vs 4.49s on main (0% faster) |
| :book: | Linting Sourcery with this PR took 2.3s vs 2.32s on main (0% faster) |
| :book: | Linting Swift with this PR took 4.5s vs 4.51s on main (0% faster) |
| :book: | Linting VLC with this PR took 1.25s vs 1.26s on main (0% faster) |
| :book: | Linting Wire with this PR took 17.78s vs 17.75s on main (0% slower) |
| :book: | Linting WordPress with this PR took 11.35s vs 11.35s on main (0% slower) |
Generated by :no_entry_sign: Danger
Issue.captureConsole
I've tried to make some tests, but I can't seem to get it work as you suggest. I think it's because it throws the error?
I get this
XCTAssertEqual failed: threw error "invalidConfiguration(ruleID: "multiline_parameters", message: Optional("Option \'max_number_of_single_line_parameters\' should be >= 1."))"
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
}
Issue.captureConsoleI've tried to make some tests, but I can't seem to get it work as you suggest. I think it's because it throws the error?
I fixed that by reporting a warning only instead of throwing an error. The rule still behaves reasonably even with confusing option combinations.