-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
New cop: MultilineBlockLayout #1079
New cop: MultilineBlockLayout #1079
Conversation
module Style | ||
# This cop checks whether the multiline do end blocks have a newline | ||
# after the start of the block. | ||
# |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strictly speaking, same rule should apply for both do/end
and {}
blocks, so I'd suggest extending the examples here and in the tests.
There is a similar cop named And you'll need to add a changelog entry. |
@bbatsov I believe I've adjusted for all of your comments except the one about removing trailing spaces on the block start line. Since there is another cop that does that already, it isn't quite in the scope of this cop's description, and it would increase the complexity of the autocorrect code, I prefer not to add the logic here. Feel free to add a commit to include the functionality if you disagree, of course :). |
…tart New cop: MultilineBlockLayout
👍 |
Added some comments to the code. Sorry for being so late. I hope you can take a look soon, @barunio. There are some things that need to be fixed, I think. |
Guess I should have read the code more carefully. |
This PR adds a new cop that was extracted from the code in #1002. It checks for the situation where a multiline block contains an inner expression on the same line as the start of the block. It includes autocorrection.