-
-
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
Handle required keyword arguments by default #724
Comments
This is a RuboCop bug (or rather an implemented feature). Naturally there should be no space after |
Yes. |
[Fix #724] Allow colon for required keyword argument without space.
Wow! Fast turnaround. Thanks. |
Hm, does this cop still support required keyword arguments? I've got a snippet which looks like:
and I still get a Rubocop error like:
I did set the TargetRubyVersion under AllCops to all possible 2.0+ Ruby versions ( Tried with Rubocop When I change the keyword arguments to have defaults:
the cop passes. Any thoughts? |
I believe |
@andyw8, sorry, I meant I subsequently tried it with all the possible versions, one by one as in:
then
... |
I tried your first code sample with RuboCop 0.37.2. With With |
@andyw8 indeed. I created a very simple stripped down example repo which confirmed what you say. My problem from above was an extract from a huge repo where I just spotted a competing nested So, in the end, turned out a very complicated misconfiguration on my end, so apologies for the false alarm, the cop works just fine. Thank you very much for your help 👍 |
It may have slipped your notice since it doesn't seem to be in the official release news item, but Ruby 2.1 allows you to omit keyword arguments' values in order to signal that those keyword arguments are required. See the "Update" section on this blog post for an example.
rubocop
doesn't seem to like this. I don't know where the styleguide stands on this, but I omit the space after the colon for the required keywords. This produces two offenses using the defaultrubocop
config…… but adding the spaces still produces one offense:
I'm not sure if this is a problem in
parser
orrubocop
, but this should probably "Just Work" out of the box. For now I'm disabling theSpaceAfterColon
cop around this line, which works fine.The text was updated successfully, but these errors were encountered: