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/Next cop crashes #1191

Closed
ojab opened this issue Jul 2, 2014 · 0 comments · Fixed by #1193
Closed

Style/Next cop crashes #1191

ojab opened this issue Jul 2, 2014 · 0 comments · Fixed by #1193

Comments

@ojab
Copy link
Contributor

ojab commented Jul 2, 2014

Style/Next cop crashes with

[1].each do |x|
  unless false
    #
  end
end
$ rubocop -d /tmp/test.rb
Inspecting 1 file
Scanning /tmp/test.rb
For /tmp: configuration from /Users/ojab/.rvm/gems/ruby-2.1.2/gems/rubocop-0.24.0/config/default.yml
Inheriting configuration from /Users/ojab/.rvm/gems/ruby-2.1.2/gems/rubocop-0.24.0/config/enabled.yml
Inheriting configuration from /Users/ojab/.rvm/gems/ruby-2.1.2/gems/rubocop-0.24.0/config/disabled.yml
Default configuration from /Users/ojab/.rvm/gems/ruby-2.1.2/gems/rubocop-0.24.0/config/default.yml
Inheriting configuration from /Users/ojab/.rvm/gems/ruby-2.1.2/gems/rubocop-0.24.0/config/enabled.yml
Inheriting configuration from /Users/ojab/.rvm/gems/ruby-2.1.2/gems/rubocop-0.24.0/config/disabled.yml
An error occurred while Style/Next cop was inspecting /tmp/test.rb.
undefined method `type' for nil:NilClass
/Users/ojab/.rvm/gems/ruby-2.1.2/gems/rubocop-0.24.0/lib/rubocop/cop/style/next.rb:76:in `simple_if_without_break?'
/Users/ojab/.rvm/gems/ruby-2.1.2/gems/rubocop-0.24.0/lib/rubocop/cop/style/next.rb:64:in `ends_with_condition?'
/Users/ojab/.rvm/gems/ruby-2.1.2/gems/rubocop-0.24.0/lib/rubocop/cop/style/next.rb:37:in `on_block'
(eval):5:in `block (2 levels) in on_block'
/Users/ojab/.rvm/gems/ruby-2.1.2/gems/rubocop-0.24.0/lib/rubocop/cop/commissioner.rb:98:in `with_cop_error_handling'
(eval):4:in `block in on_block'
(eval):2:in `each'
(eval):2:in `on_block'
/Users/ojab/.rvm/gems/ruby-2.1.2/gems/ast-2.0.0/lib/ast/processor.rb:239:in `process'
/Users/ojab/.rvm/gems/ruby-2.1.2/gems/rubocop-0.24.0/lib/rubocop/cop/commissioner.rb:58:in `investigate'
/Users/ojab/.rvm/gems/ruby-2.1.2/gems/rubocop-0.24.0/lib/rubocop/cop/team.rb:33:in `inspect_file'
/Users/ojab/.rvm/gems/ruby-2.1.2/gems/rubocop-0.24.0/lib/rubocop/runner.rb:87:in `inspect_file'
/Users/ojab/.rvm/gems/ruby-2.1.2/gems/rubocop-0.24.0/lib/rubocop/runner.rb:69:in `block in process_file'
/Users/ojab/.rvm/gems/ruby-2.1.2/gems/rubocop-0.24.0/lib/rubocop/runner.rb:64:in `loop'
/Users/ojab/.rvm/gems/ruby-2.1.2/gems/rubocop-0.24.0/lib/rubocop/runner.rb:64:in `process_file'
/Users/ojab/.rvm/gems/ruby-2.1.2/gems/rubocop-0.24.0/lib/rubocop/runner.rb:27:in `block in run'
/Users/ojab/.rvm/gems/ruby-2.1.2/gems/rubocop-0.24.0/lib/rubocop/runner.rb:25:in `each'
/Users/ojab/.rvm/gems/ruby-2.1.2/gems/rubocop-0.24.0/lib/rubocop/runner.rb:25:in `run'
/Users/ojab/.rvm/gems/ruby-2.1.2/gems/rubocop-0.24.0/lib/rubocop/cli.rb:24:in `run'
/Users/ojab/.rvm/gems/ruby-2.1.2/gems/rubocop-0.24.0/bin/rubocop:14:in `block in <top (required)>'
/Users/ojab/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
/Users/ojab/.rvm/gems/ruby-2.1.2/gems/rubocop-0.24.0/bin/rubocop:13:in `<top (required)>'
/Users/ojab/.rvm/gems/ruby-2.1.2/bin/rubocop:23:in `load'
/Users/ojab/.rvm/gems/ruby-2.1.2/bin/rubocop:23:in `<main>'
/Users/ojab/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'
/Users/ojab/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'
W

Offenses:

/tmp/test.rb:1:14: W: Lint/UnusedBlockArgument: Unused block argument - x. You can omit the argument if you don't care about it.
[1].each do |x|
             ^
/tmp/test.rb:2:10: W: Lint/LiteralInCondition: Literal false appeared in a condition.
  unless false
         ^^^^^

1 file inspected, 2 offenses detected

1 error occurred:
An error occurred while Style/Next cop was inspecting /tmp/test.rb.
Errors are usually caused by RuboCop bugs.
Please, report your problems to RuboCop's issue tracker.
Mention the following information in the issue report:
0.24.0 (using Parser 2.2.0.pre.3, running on ruby 2.1.2 x86_64-darwin13.0)
Finished in 0.033318 seconds
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

Successfully merging a pull request may close this issue.

1 participant