Add auto-correction, indentation config, and multi-violation support to multiline_call_arguments#6745
Conversation
b183a6a to
78a2da1
Compare
|
@SimplyDanny Let's add correctable for The CI failure on oss_scan is not related to this PR — it's a danger bot failing to post a comment due to the repository's interaction limits (422 - Interactions on this repository have been restricted to prior contributors only) |
| /// | ||
| /// - `tab`: Use tab character for indentation | ||
| /// - `spaces(count:)`: Use the specified number of spaces | ||
| enum IndentationStyle: Hashable, Sendable { |
There was a problem hiding this comment.
There is already a IndentationStyle that can be configured in configuration files and is supposed to apply globally. Can we use it in this rule as well?
There was a problem hiding this comment.
Good point — done. The rule-local IndentationStyle has been replaced by the
shared IndentationStyle type from SwiftLintCore, which is the same type
used by the global indentation configuration. This required two changes:
- Moving the type to
SwiftLintCore(the lowest common dependency) and adding
AcceptableByConfigurationElementconformance +indentationStringproperty
so both the rule andConfiguration.indentationcan use it. - Aligning the string value to
"tabs"(matching the global config format)
instead of the previous"tab".
f16bd4c to
8b5b043
Compare
Generated by 🚫 Danger |
3c09c9b to
c2b5aa8
Compare
c2b5aa8 to
9510ef7
Compare
Summary
Enhances the
multiline_call_argumentsopt-in rule with auto-correction, a newindentationconfiguration option, and multi-violation detection in a single pass.Auto-correction (
--fix))moves to its own line at the call's base indent\n+ indent in the appropriate range--fixpassindentationconfigurationindentation(integer ≥ 1 for spaces, or the string"tab"; default:4)0and negative values are invalid and cause a configuration errorMulti-violation support
duplicateArgumentStartLineViolationandnewlineAfterCommaViolationreturned at the first match, requiring repeated--fixpasses for calls with multiple same-line argument pairsreasonedViolationsreturns[ReasonedRuleViolation])Documentation
RuleDescription.descriptioninto concisedescription(what) + structuredrationale(why/how) with markdown sections