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

An error occurred while Style/StabbyLambdaParentheses #2449

Closed
michaljuris opened this issue Nov 23, 2015 · 0 comments
Closed

An error occurred while Style/StabbyLambdaParentheses #2449

michaljuris opened this issue Nov 23, 2015 · 0 comments

Comments

@michaljuris
Copy link

Hello I'm getting this error:

An error occurred while Style/StabbyLambdaParentheses cop was inspecting xxxxx.rb

The code causing this error is below:

  def localize_value(value)
    case value
    when lambda(&:nil?)   # <-- this line is causing the error
      value
...
    else
      value
    end
  end

Here is the backtrace

Inspecting 1 file
Scanning /home/juris/src/expert/lib/version_change_formatter.rb
For /home/juris/src/expert: configuration from /home/juris/src/expert/.rubocop.yml
Inheriting configuration from /home/juris/src/expert/.rubocop_todo.yml
Default configuration from /home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/config/default.yml
Inheriting configuration from /home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/config/enabled.yml
Inheriting configuration from /home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/config/disabled.yml
An error occurred while Style/StabbyLambdaParentheses cop was inspecting /home/juris/src/expert/lib/version_change_formatter.rb.
undefined method `begin' for #<Parser::Source::Map::Variable:0x00000002364690>
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/style/stabby_lambda_parentheses.rb:103:in `parentheses?'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/style/stabby_lambda_parentheses.rb:30:in `on_send'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/commissioner.rb:37:in `block (2 levels) in on_send'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/commissioner.rb:87:in `with_cop_error_handling'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/commissioner.rb:36:in `block in on_send'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/commissioner.rb:34:in `each'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/commissioner.rb:34:in `on_send'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:259:in `process'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:276:in `block in process_all'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:275:in `map'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:275:in `process_all'
/home/juris/.rvm/gems/ruby-2.2.3/gems/parser-2.2.3.0/lib/parser/ast/processor.rb:9:in `process_regular_node'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/commissioner.rb:41:in `on_when'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:259:in `process'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:276:in `block in process_all'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:275:in `map'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:275:in `process_all'
/home/juris/.rvm/gems/ruby-2.2.3/gems/parser-2.2.3.0/lib/parser/ast/processor.rb:9:in `process_regular_node'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/commissioner.rb:41:in `on_case'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:259:in `process'
/home/juris/.rvm/gems/ruby-2.2.3/gems/parser-2.2.3.0/lib/parser/ast/processor.rb:122:in `on_def'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/commissioner.rb:41:in `on_def'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:259:in `process'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:276:in `block in process_all'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:275:in `map'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:275:in `process_all'
/home/juris/.rvm/gems/ruby-2.2.3/gems/parser-2.2.3.0/lib/parser/ast/processor.rb:9:in `process_regular_node'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/commissioner.rb:41:in `on_begin'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:259:in `process'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:276:in `block in process_all'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:275:in `map'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:275:in `process_all'
/home/juris/.rvm/gems/ruby-2.2.3/gems/parser-2.2.3.0/lib/parser/ast/processor.rb:9:in `process_regular_node'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/commissioner.rb:41:in `on_class'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:259:in `process'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/commissioner.rb:53:in `investigate'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/team.rb:34:in `inspect_file'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/runner.rb:190:in `inspect_file'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/runner.rb:157:in `block in do_inspection_loop'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/runner.rb:151:in `loop'
Inspecting 1 file
Scanning /home/juris/src/expert/lib/version_change_formatter.rb
For /home/juris/src/expert: configuration from /home/juris/src/expert/.rubocop.yml
Inheriting configuration from /home/juris/src/expert/.rubocop_todo.yml
Default configuration from /home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/config/default.yml
Inheriting configuration from /home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/config/enabled.yml
Inheriting configuration from /home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/config/disabled.yml
An error occurred while Style/StabbyLambdaParentheses cop was inspecting /home/juris/src/expert/lib/version_change_formatter.rb.
undefined method `begin' for #<Parser::Source::Map::Variable:0x00000002364690>
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/style/stabby_lambda_parentheses.rb:103:in `parentheses?'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/style/stabby_lambda_parentheses.rb:30:in `on_send'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/commissioner.rb:37:in `block (2 levels) in on_send'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/commissioner.rb:87:in `with_cop_error_handling'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/commissioner.rb:36:in `block in on_send'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/commissioner.rb:34:in `each'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/commissioner.rb:34:in `on_send'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:259:in `process'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:276:in `block in process_all'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:275:in `map'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:275:in `process_all'
/home/juris/.rvm/gems/ruby-2.2.3/gems/parser-2.2.3.0/lib/parser/ast/processor.rb:9:in `process_regular_node'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/commissioner.rb:41:in `on_when'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:259:in `process'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:276:in `block in process_all'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:275:in `map'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:275:in `process_all'
/home/juris/.rvm/gems/ruby-2.2.3/gems/parser-2.2.3.0/lib/parser/ast/processor.rb:9:in `process_regular_node'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/commissioner.rb:41:in `on_case'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:259:in `process'
/home/juris/.rvm/gems/ruby-2.2.3/gems/parser-2.2.3.0/lib/parser/ast/processor.rb:122:in `on_def'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/commissioner.rb:41:in `on_def'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:259:in `process'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:276:in `block in process_all'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:275:in `map'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:275:in `process_all'
/home/juris/.rvm/gems/ruby-2.2.3/gems/parser-2.2.3.0/lib/parser/ast/processor.rb:9:in `process_regular_node'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/commissioner.rb:41:in `on_begin'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:259:in `process'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:276:in `block in process_all'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:275:in `map'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:275:in `process_all'
/home/juris/.rvm/gems/ruby-2.2.3/gems/parser-2.2.3.0/lib/parser/ast/processor.rb:9:in `process_regular_node'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/commissioner.rb:41:in `on_class'
/home/juris/.rvm/gems/ruby-2.2.3/gems/ast-2.1.0/lib/ast/processor/mixin.rb:259:in `process'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/commissioner.rb:53:in `investigate'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/team.rb:34:in `inspect_file'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/runner.rb:190:in `inspect_file'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/runner.rb:157:in `block in do_inspection_loop'
/home/juris/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/runner.rb:151:in `loop'
@bbatsov bbatsov closed this as completed in 0a6e992 Dec 9, 2015
bbatsov added a commit that referenced this issue Dec 9, 2015
[Fix #2449] Fix StabbyLambdaParentheses with lambda
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

1 participant