-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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 spaces as EnforcedStyle to SpaceInsideParens. #5672
Add spaces as EnforcedStyle to SpaceInsideParens. #5672
Conversation
Simply supply `EnforcedStyle: space` in your rubocop.yml configuration and instead of enforcing no spaces inside parens, it will enforce spaces. Even supports auto-correct! Stylistic choice, to be sure, but one that can help alleviate cluttered code and parentheses hell.
This defaults the EnforcedStyle to `no_space` and then lists the supported styles, including `space`.
Ping us when the build is green and this is ready for review. |
You need to finish the checklist (add |
Will do! Sorry, we started using it in our codebase and it's working great so this got pushed down the to-do pile. :) |
@joshuapinter Fair enough. Let us know when you decide to pick up it up again. |
@bbatsov Will do. Should be next week after we catch up on a few things. |
Hey Guys, I've added an entry to $ bundle exec rake generate_cops_documentation
rake aborted!
NoMethodError: undefined method `type' for 68576:Fixnum
/Users/joshuapinter/.rbenv/versions/2.2.0/bin/bundle:23:in `load'
/Users/joshuapinter/.rbenv/versions/2.2.0/bin/bundle:23:in `<main>'
Tasks: TOP => generate_cops_documentation => yard_for_generate_documentation
(See full trace by running task with --trace) Any ideas? Thanks. |
With `rake generate_cops_documentation`. * Note: I was running Ruby 2.2.0 in my rbenv and was running into the following error: ```bash NoMethodError: undefined method `type' for 68576:Fixnum /Users/joshuapinter/.rbenv/versions/2.2.0/bin/bundle:23:in `load' ``` Changing my local rbenv to use Ruby 2.5.0 fixed the issue.
Figured out what the issue was. I was running Ruby 2.2.0 in my rbenv. Changing my local rbenv to use Ruby 2.5.0 fixed the issue. I regenerated the docs, resolved conflicts and pushed. Just waiting on tests to pass now. Btw, I don't think I can squash my commits now that I've created this PR but I think you can do that on your side when you merge this in. Correct me if I'm wrong, though, and let me know how to do it. Thanks! |
Boom! Checks passing. We should be good to go! |
LGMT! 👍 |
👍 |
Fixes #5666.
Add config option for Style/SpaceInsideParens Cop to enforce spaces.
Simply supply
EnforcedStyle: space
in your rubocop.yml configuration and instead of enforcing no spaces inside parens, it will enforce spaces.Even supports auto-correct!
Stylistic choice, to be sure, but one that can help alleviate cluttered code and parentheses hell.
Add documentation for
EnforcedStyle: space
option.Add Layout/SpaceInsideParens to default.yml.
This defaults the EnforcedStyle to
no_space
and then lists the supported styles, includingspace
.Code formatting to match rubocop style.
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).and description in grammatically correct, complete sentences.
rake default
orrake parallel
. It executes all tests and RuboCop for itself, and generates the documentation.