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

No spaces after block's left curly or before block's right curly #529

Closed
chriseppstein opened this issue Sep 30, 2013 · 6 comments
Closed
Assignees

Comments

@chriseppstein
Copy link

https://github.com/nex3/sass/blob/master/test/rubocop_extensions.rb

We prefer 10.times {puts 'hi'} So, basically the way we think about it is if there's a space in the block declaration it's attached to the right side of the argument list, not to the curly.

@bbatsov
Copy link
Collaborator

bbatsov commented Oct 1, 2013

@jonas054 Would you handle this? I think we should probably have config params like RequireSpaceAfterOpeningParen and RequireSpaceBeforeClosingParen and set them to true by default.

@ghost ghost assigned jonas054 Oct 1, 2013
@jonas054
Copy link
Collaborator

jonas054 commented Oct 1, 2013

Yes!

@jonas054
Copy link
Collaborator

jonas054 commented Oct 2, 2013

I just have a few things to get clear before I start. First of all, is it really necessary to be able to configure RuboCop to allow 10.times {puts 'hi' } and 10.times { puts 'hi'}? Or can we have just one parameter that allows leaving out the spaces inside (both) the braces?

@bbatsov
Copy link
Collaborator

bbatsov commented Oct 2, 2013

Good point! We need to support just { something } and {something} as with hashes. Plus the special case that when { something } is the used style we have to also consider the variable controlling {|x| something } whether this style is acceptable or not.

@jonas054
Copy link
Collaborator

jonas054 commented Oct 2, 2013

Thanks for clearing that up. My next question is whether not requiring space is enough. I think that if we allow, by configuration, to leave the spaces out ({something}), we should consider { something } an offence.

@bbatsov
Copy link
Collaborator

bbatsov commented Oct 2, 2013

The check should be strict. If you said you want to enforce the style {something} then anything that's not it is an offence - { something }, { something} and {something }.

The EnforcedStyle params should have the options space inside braces and no space inside braces.

bbatsov added a commit that referenced this issue Oct 3, 2013
…gurable

[Fix #529] Add EnforcedStyle config param to SpaceAroundBlockBraces.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants