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

undefined method `begin_type?' for nil:NilClass (error occurred while RSpec/FilePath cop was inspecting...) #1002

Closed
ruvaleev opened this issue Aug 17, 2020 · 1 comment

Comments

@ruvaleev
Copy link


Expected behavior

rubocop doesn't throws any exception or alerts.

Actual behavior

After updating rubocop-rspec gem (rubocop-rspec (1.42.0)) I got this alert in console:

3 errors occurred:
An error occurred while RSpec/FilePath cop was inspecting /.../app/channels/application_cable/channel.rb.
An error occurred while RSpec/FilePath cop was inspecting /.../app/channels/application_cable/connection.rb.
An error occurred while RSpec/FilePath cop was inspecting /.../app/controllers/application_controller.rb.
Errors are usually caused by RuboCop bugs.
Please, report your problems to RuboCop's issue tracker.
https://github.com/rubocop-hq/rubocop/issues

Mention the following information in the issue report:
0.89.1 (using Parser 2.7.1.4, rubocop-ast 0.3.0, running on ruby 2.7.1 x86_64-darwin19)

All this files are similar - they are empty and doesn't used at all:

app/channels/application_cable/channel.rb:

# frozen_string_literal: true

module ApplicationCable
  class Channel < ActionCable::Channel::Base
  end
end

app/channels/application_cable/connection.rb:

# frozen_string_literal: true

module ApplicationCable
  class Connection < ActionCable::Connection::Base
  end
end

app/controllers/application_controller.rb:

# frozen_string_literal: true

class ApplicationController < ActionController::API
end

when I run rubocop -d app/controllers/application_controller.rb, I got this trace:

An error occurred while RSpec/FilePath cop was inspecting /Users/ruslan/synergy/synergy-lms-api/app/controllers/application_controller.rb.
undefined method `begin_type?' for nil:NilClass
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-rspec-1.43.0/lib/rubocop/rspec/top_level_group.rb:41:in `top_level_nodes'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-rspec-1.43.0/lib/rubocop/rspec/top_level_group.rb:44:in `top_level_nodes'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-rspec-1.43.0/lib/rubocop/rspec/top_level_group.rb:26:in `top_level_groups'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-rspec-1.43.0/lib/rubocop/rspec/top_level_group.rb:18:in `on_new_investigation'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/cop/commissioner.rb:103:in `block (2 levels) in invoke'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/cop/commissioner.rb:112:in `with_cop_error_handling'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/cop/commissioner.rb:102:in `block in invoke'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/cop/commissioner.rb:101:in `each'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/cop/commissioner.rb:101:in `invoke'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/cop/commissioner.rb:72:in `investigate'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/cop/team.rb:151:in `investigate_partial'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/cop/team.rb:83:in `investigate'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/runner.rb:295:in `inspect_file'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/runner.rb:245:in `block in do_inspection_loop'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/runner.rb:277:in `block in iterate_until_no_changes'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/runner.rb:270:in `loop'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/runner.rb:270:in `iterate_until_no_changes'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/runner.rb:241:in `do_inspection_loop'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/runner.rb:121:in `block in file_offenses'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/runner.rb:146:in `file_offense_cache'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/runner.rb:120:in `file_offenses'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/runner.rb:111:in `process_file'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/runner.rb:90:in `block in each_inspected_file'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/runner.rb:89:in `each'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/runner.rb:89:in `reduce'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/runner.rb:89:in `each_inspected_file'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/runner.rb:78:in `inspect_files'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/runner.rb:39:in `run'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/cli/command/execute_runner.rb:21:in `execute_runner'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/cli/command/execute_runner.rb:13:in `run'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/cli/command.rb:10:in `run'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/cli/environment.rb:17:in `run'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/cli.rb:65:in `run_command'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/cli.rb:72:in `execute_runners'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/lib/rubocop/cli.rb:41:in `run'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/exe/rubocop:13:in `block in <top (required)>'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/2.7.0/benchmark.rb:308:in `realtime'
/Users/ruslan/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.89.1/exe/rubocop:12:in `<top (required)>'
/Users/ruslan/.rbenv/versions/2.7.1/bin/rubocop:23:in `load'
/Users/ruslan/.rbenv/versions/2.7.1/bin/rubocop:23:in `<main>'
.

1 file inspected, no offenses detected

Steps to reproduce the problem

run rubocop

RuboCop version

0.89.1 (using Parser 2.7.1.4, rubocop-ast 0.3.0, running on ruby 2.7.1 x86_64-darwin19)

@koic koic transferred this issue from rubocop/rubocop Aug 17, 2020
@koic
Copy link
Member

koic commented Aug 17, 2020

This issue is a dup with #999 and resolved by #1000. Can you update rubocop-rspec 1.43.1?
Cc @bquorning

@koic koic closed this as completed Aug 17, 2020
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