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

Style/SymbolProc cop crashes when method call has no receiver #1340

Closed
smangelsdorf opened this issue Sep 18, 2014 · 1 comment
Closed

Style/SymbolProc cop crashes when method call has no receiver #1340

smangelsdorf opened this issue Sep 18, 2014 · 1 comment

Comments

@smangelsdorf
Copy link
Contributor

The Style/SymbolProc cop will crash when it encounters a line of code which looks like:

coll.map { |s| bare_method }

Crash message is:

An error occurred while Style/SymbolProc cop was inspecting /Users/shaun/tmp/test.rb
undefined method `type' for nil:NilClass
/Users/shaun/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rubocop-0.26.0/lib/rubocop/cop/style/symbol_proc.rb:36:in `on_block'
$ rubocop -V
0.26.0 (using Parser 2.2.0.pre.4, running on ruby 2.1.2 x86_64-darwin13.0)

Pull request incoming...

@joshchu
Copy link

joshchu commented Sep 18, 2014

👍 we hit this as well!

bbatsov added a commit that referenced this issue Sep 18, 2014
[Fix #1340] Handle call with no receiver correctly in Style/SymbolProc cop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants