Rule Request: Vertical Whitespace Opening/Closing Braces With Configuration
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 19.7k
- Forks
- 2.3k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 11
Description
This ticket is related to issue #1518 and to PR #2291.
Once #2291 is merged, it'd be good to extend the functionality of the vertical_whitespace_opening_braces and vertical_whitespace_closing_braces so that they can be configured for braces of different types.
-
Why should this rule be added?
These rules are great for function braces, but for class/struct braces it might be good to allow 1 empty line to make the code easier to read.
-
Provide several examples of what would and wouldn't trigger violations.
// This looks good and wouldn't trigger violations class Foo { func doSomething() { let whatever = 1 } } // This is a bit too crowded and would trigger violations class Foo { func doSomething() { let whatever = 1 } } -
Should the rule be configurable, if so what parameters should be configurable?
This is an example of possible configurations for these rules:
vertical_whitespace_opening_braces: max_empty_lines_class: 1 max_empty_lines_struct: 1 max_empty_lines_protocol: 1 max_empty_lines_extension: 1 max_empty_lines_func: 0The configurations above are just a suggestion, I have only been using this library for a week so there are probably better ways to add such configurations to these rules.
-
Should the rule be opt-in or enabled by default? Why?
I would enable this rule by default and set
1as the default forclass,struct,protocol,extension, and0forfunc.
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_whitespace_opening_braces and vertical_whitespace_closing_braces rules, along with related issue #1518 and PR #2291. Define how configuration should distinguish class, struct, protocol, extension, and function braces, document triggering and non-triggering examples, and verify the proposed defaults and opt-in behavior.
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