We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Style/ExplicitBlockArgument not to crash on the code below.
Style/ExplicitBlockArgument
Style/ExplicitBlockArgument is crashing on a file that just contains this code:
if @foo render "partial", prop: @bar do yield end end
Here's the backtrace:
An error occurred while Style/ExplicitBlockArgument cop was inspecting test.rb:3:4. undefined method `arguments?' for nil:NilClass /Users/alex/.rvm/gems/ruby-2.7.1/gems/rubocop-0.92.0/lib/rubocop/cop/style/explicit_block_argument.rb:80:in `add_block_argument' /Users/alex/.rvm/gems/ruby-2.7.1/gems/rubocop-0.92.0/lib/rubocop/cop/style/explicit_block_argument.rb:66:in `block (2 levels) in on_yield' /Users/alex/.rvm/gems/ruby-2.7.1/gems/rubocop-0.92.0/lib/rubocop/cop/base.rb:333:in `correct' /Users/alex/.rvm/gems/ruby-2.7.1/gems/rubocop-0.92.0/lib/rubocop/cop/base.rb:126:in `add_offense' /Users/alex/.rvm/gems/ruby-2.7.1/gems/rubocop-0.92.0/lib/rubocop/cop/style/explicit_block_argument.rb:60:in `block in on_yield' /Users/alex/.rvm/gems/ruby-2.7.1/gems/rubocop-0.92.0/lib/rubocop/cop/style/explicit_block_argument.rb:57:in `yielding_block?' /Users/alex/.rvm/gems/ruby-2.7.1/gems/rubocop-0.92.0/lib/rubocop/cop/style/explicit_block_argument.rb:57:in `on_yield' /Users/alex/.rvm/gems/ruby-2.7.1/gems/rubocop-0.92.0/lib/rubocop/cop/commissioner.rb:99:in `block (2 levels) in trigger_responding_cops' /Users/alex/.rvm/gems/ruby-2.7.1/gems/rubocop-0.92.0/lib/rubocop/cop/commissioner.rb:152:in `with_cop_error_handling' /Users/alex/.rvm/gems/ruby-2.7.1/gems/rubocop-0.92.0/lib/rubocop/cop/commissioner.rb:98:in `block in trigger_responding_cops'
The actual error came up when running haml_lint. But I think it's a rubocop error, because you can replicate in a ruby file.
For the record, this works fine:
def method if @foo render("partial", prop: @bar) do yield end end end
$ [bundle exec] rubocop -V 0.92.0 (using Parser 2.7.1.5, rubocop-ast 0.7.1, running on ruby 2.7.1 x86_64-darwin19)
The text was updated successfully, but these errors were encountered:
#8826 should fix this.
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Expected behavior
Style/ExplicitBlockArgument
not to crash on the code below.Actual behavior
Style/ExplicitBlockArgument
is crashing on a file that just contains this code:Here's the backtrace:
The actual error came up when running haml_lint. But I think it's a rubocop error, because you can replicate in a ruby file.
For the record, this works fine:
RuboCop version
The text was updated successfully, but these errors were encountered: