Vertical Whitespace in between functions
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 19.7k
- Forks
- 2.3k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 11
Description
I like to have a single empty line in between logical blocks, and two empty lines in between functions, at the top of a class, and at the bottom of a class (between the last function and the class's closing bracket).
In order not to get the warning about having too much vertical whitespace, I had to customize to the rule to allow up to two lines, but that is of course not specific to inside and outside of functions, so SL won't catch such inconsistencies.
It would be nice to be able to customize this.
Example:
// MARK: Life Cycle
override func viewDidLoad() {
super.viewDidLoad()
let myButton = Button
let myTable = Table
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
let myButton = Button
let myTable = Table
}
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
No source files or tests are named in the issue. Start by locating SwiftLint's vertical-whitespace rule and its configuration, then determine how separate limits for logical blocks and function or class boundaries should be represented; done means the example can be configured and inconsistent spacing is reported correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100