Rule request: [Wrapped Vertical Parameter Alignment (On Call)]
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 19.7k
- Forks
- 2.3k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 11
Description
Rule Request
1. Why should this rule be added?
I'm following this code style because my line width is forced to 80 chars (one tab are two whitespaces) and the simple Vertical Parameter Alignment (On Call) does not work in most cases.
2. Provide several examples of what would and wouldn't trigger violations.
Non Triggering Examples
func foo(bar: Int)
func foo(bar: Int) -> String
func foo(
bar: Int
) -> String
func validateFunction(
_ file: File, kind: SwiftDeclarationKind,
dictionary: [String: SourceKitRepresentable]
) -> [StyleViolation]
func regex(
_ pattern: String,
options: NSRegularExpression.Options = [
.anchorsMatchLines,
.dotMatchesLineSeparators
]
) -> NSRegularExpression
func foo(
a: Void,
b: [String: String] =
[:]
) {
...
}
func foo(
data: (
size: CGSize,
identifier: String
)
) {}
UIView.animate(
withDuration: 0.4,
animations: { blurredImageView.alpha = 1 },
completion: { _ in
self.hideLoading()
}
)
Triggering Examples
foo(param1: 1, param2: bar
param3: false, param4: true)
foo(param1: 1, param2: bar
param3: false,
param4: true)
func validateFunction(_ file: File, kind: SwiftDeclarationKind,
dictionary: [String: SourceKitRepresentable]) { }
func validateFunction(_ file: File, kind: SwiftDeclarationKind,
dictionary: [String: SourceKitRepresentable]) -> [StyleViolation]
func validateFunction(_ file: File, kind: SwiftDeclarationKind,
dictionary: [String: SourceKitRepresentable])
-> [StyleViolation]
func validateFunction(
_ file: File, kind: SwiftDeclarationKind,
dictionary: [String: SourceKitRepresentable]) -> [StyleViolation]
func validateFunction(_ file: File, kind: SwiftDeclarationKind,
↓dictionary: [String: SourceKitRepresentable]) { }
func validateFunction(_ file: File, kind: SwiftDeclarationKind,
↓dictionary: [String: SourceKitRepresentable]) { }
func validateFunction(_ file: File,
↓kind: SwiftDeclarationKind,
↓dictionary: [String: SourceKitRepresentable]) { }
func validateFunction(
_ file: File,
↓kind: SwiftDeclarationKind,
↓dictionary: [String: SourceKitRepresentable]) { }
func validateFunction(
_ file: File,
kind: SwiftDeclarationKind,
dictionary: [String: SourceKitRepresentable]) { }
UIView.animate(withDuration: 0.4, animations: {
blurredImageView.alpha = 1
}, completion: { _ in
self.hideLoading()
})
func foo(
label param1: Type, label param2: Type
)
3. Should the rule be configurable, if so what parameters should be configurable?
This can be an opt-in extension on the exiting two rules to force wrapping the first label / parameter.
4. Should the rule be opt-in or enabled by default? Why?
Opt-in in both cases:
- Standalone rules
- Extension on exiting rules
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing Vertical Parameter Alignment (On Call) rule and the proposed opt-in extension points. Use the triggering and non-triggering Swift examples as acceptance cases, and consider the work done when the selected opt-in behavior is covered and the examples are classified consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100