Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Formatting proposal: Ensure empty line between method definitions#461

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
molawson wants to merge1 commit intoruby-syntax-tree:main
base:main
Choose a base branch
Loading
frommolawson:empty-line-between-method-defs

Conversation

molawson
Copy link
Contributor

We've been using SyntaxTree extensively for formatting in a number of our apps at work, and I recently came across something I was a bit surprised wasn't already part of the formatting rules: ensuring there's a blank line between each method definition.

Before this change, the following code would be unchanged by SyntaxTree:

deffooenddefbarend

After, it will be formatted like so:

deffooenddefbarend

Ithink this is a fairly uncontroversial formatting opinion (though I've certainly misjudged these before 😄). It lines up with the RuboCop default forLayout/EmptyLineBetweenDefs, which of course is disable when using the SyntaxTree RuboCop config. I stopped short of doing the same for classes and modules as method definitions seemed the most common to have in succession.

I took a swing at implementing the change, but I'm not terribly confident that this is exactly the right approach. I have run this against a few of our code bases and haven't seen any unintended changes.

Is this something you'd consider tweaking in SyntaxTree? If so, is there anything I can do differently in the implementation to help it fit in with the rest of the project?

CvX and wassimk reacted with heart emoji
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@molawson

[8]ページ先頭

©2009-2025 Movatter.jp