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

Bug in Style/KeywordParametersOrder #9234

Closed
zverok opened this issue Dec 15, 2020 · 0 comments · Fixed by #9236
Closed

Bug in Style/KeywordParametersOrder #9234

zverok opened this issue Dec 15, 2020 · 0 comments · Fixed by #9236
Labels

Comments

@zverok
Copy link
Contributor

zverok commented Dec 15, 2020

Versions: 1.6.1 (using Parser 2.7.2.0, rubocop-ast 1.3.0, running on ruby 2.5.5 x86_64-linux)

Test code:

foo 'bar' do |error: 'text', code:|
end

Glitch:

An error occurred while Style/KeywordParametersOrder cop was inspecting /home/zverok/playground/ruby/test_rbcp.rb:1:14.
undefined method `arguments' for nil:NilClass
/home/zverok/.rvm/gems/ruby-2.6.3/gems/rubocop-1.6.1/lib/rubocop/cop/style/keyword_parameters_order.rb:38:in `block in on_kwoptarg'
@koic koic added the bug label Dec 15, 2020
koic added a commit to koic/rubocop that referenced this issue Dec 15, 2020
Fixes rubocop#9234.

This PR fixes the error for `Style/KeywordParametersOrder` and
makes it aware of block keyword parameters.
Keyword parameters can be used with block arguments as well as method
arguments, but `Style/KeywordParametersOrder` cop were unaware of it.

This PR adds block arguments to the targets for consistency.
If the cop need an option to the above customize, I will open a separate PR.
bbatsov pushed a commit that referenced this issue Dec 16, 2020
Fixes #9234.

This PR fixes the error for `Style/KeywordParametersOrder` and
makes it aware of block keyword parameters.
Keyword parameters can be used with block arguments as well as method
arguments, but `Style/KeywordParametersOrder` cop were unaware of it.

This PR adds block arguments to the targets for consistency.
If the cop need an option to the above customize, I will open a separate PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants