Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: a new rule NoEmptyLinesOpeningClosingBracesOnMethods - No empty lines on opening or closing braces in methods only #819

Open
Pispa339 opened this issue Sep 26, 2024 · 3 comments

Comments

@Pispa339
Copy link

The existing rule NoEmptyLinesOpeningClosingBraces is somewhat too much of a catch-all rule. I'd like to request a more fine-grained rule where empty lines on opening or closing braces would be disallowed for methods, but allowed for type declarations.

For example the following would be disallowed within the rule

func hello() {

    // code starts here

whereas the following would be allowed

class SomeClass {

    // Code starts here
@ahoppen
Copy link
Member

ahoppen commented Sep 26, 2024

Synced to Apple’s issue tracker as rdar://136754857

@allevato
Copy link
Member

These are the kinds of extremely fine-grained customizations that I'm really hesitant to add. NoEmptyLinesOpeningClosingBraces was added because it allows the formatter to be more opinionated across the board (which I think is a good goal). What would be the benefit of allowing the blank line for types but not functions?

@Pispa339
Copy link
Author

Pispa339 commented Oct 7, 2024

This request stems mostly from this our team's preference and our desire to be able to configure the formatter to our liking. However, this also seems to be the formatting used in Apple's example projects like DiffableDataSourceSample for example.
I can definitely see why customization like this is not something one would consider worth pursuing given there's no real benefit beyond personal preference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants