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

Fix Style/Lambda whitespacing when auto-correct unparenthesized args #3160

Merged
merged 1 commit into from
May 27, 2016

Conversation

palkan
Copy link
Contributor

@palkan palkan commented May 24, 2016

This PR makes autocorrect more accurate and replace

# bad
-> hello do
  puts hello
end

with

# good
lambda do |hello|
  puts hello
end

instead of

# not so good
lambda  do |hello|
  puts hello
end

@palkan palkan force-pushed the fix-lambda branch 2 times, most recently from 68c6f0d to ab8fbe9 Compare May 24, 2016 19:53
@palkan
Copy link
Contributor Author

palkan commented May 24, 2016

And this one fixes #3142 , btw.

@@ -181,6 +185,24 @@ def arg_to_unparenthesized_call?(node)
index = parent.children.index { |c| c.equal?(node) }
index >= 2
end

def unparenthesized_literal_args?(args)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer if all calls within a class are downwards, so move this method last.

@jonas054
Copy link
Collaborator

One minor comment. Looks good otherwise! 👍
BTW, put [Fix #3142] at the beginning of the commit message.

@bbatsov
Copy link
Collaborator

bbatsov commented May 27, 2016

You'll also have to rebase.

@palkan
Copy link
Contributor Author

palkan commented May 27, 2016

Done.

@bbatsov bbatsov merged commit a87f3ab into rubocop:master May 27, 2016
Neodelf pushed a commit to Neodelf/rubocop that referenced this pull request Oct 15, 2016
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

Successfully merging this pull request may close these issues.

3 participants