-
-
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
Add a cop to prevent -> (
lambda format
#3631
Comments
While I don't care at all about 1.9.3 compatibility, I agree that we should stick to the style without a space for historical reasons. I have some memory that at one points we added some similar check to RuboCop, but I might be mistaken. |
I like the idea of a cop to keep this consistent, but I would like the style to be configurable as I prefer the style with the space. |
Fine by me. |
I have a working cop for this, and will commit soon. |
As discovered in rmosolgo/graphql-ruby#313:
-> (arg) { ... }
and->(arg) { ... }
are supported in Ruby 2+ (notice the space between->
and the parenthesis.-> (arg) { ... }
is not supported in Ruby 1.9.3 and the interpreter reports:It seems reasonable to me to enforce
->(arg) { ... }
in style guides. After all, all examples in Rubocop's doc or your Ruby style guide use this format consistently.This is very valuable when developing a library that supports both versions 1.9.3 and 2+.
Looking forward to hearing your opinion on that.
The text was updated successfully, but these errors were encountered: