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 `support_autocorrect?'" when using "--auto-gen-config" #8256

Closed
jsantos opened this issue Jul 7, 2020 · 0 comments · Fixed by #8258
Closed

"undefined method `support_autocorrect?'" when using "--auto-gen-config" #8256

jsantos opened this issue Jul 7, 2020 · 0 comments · Fixed by #8258
Labels
Milestone

Comments

@jsantos
Copy link

jsantos commented Jul 7, 2020

While running bundle exec rubocop --auto-gen-config, I get an error after upgrading to 0.8.7.

Might be related to the new changelog entries that handle autocorrect (#8164, #8223, #8172).

Although, if I simply run bundle exec rubocop, there are no new offenses of any of these types.


Expected behavior

While issuing the bundle exec rubocop --auto-gen-config, a .rubocop_todo.yml file should be generated, without producing errors.

Actual behavior

The command produces an error, here's the stacktrace:

undefined method `support_autocorrect?' for #<RuboCop::Cop::Naming::MethodName:0x00007ffa0f877600>
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.87.0/lib/rubocop/formatter/disabled_config_formatter.rb:118:in `output_cop_comments'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.87.0/lib/rubocop/formatter/disabled_config_formatter.rb:95:in `output_cop'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.87.0/lib/rubocop/formatter/disabled_config_formatter.rb:82:in `block in output_offenses'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.87.0/lib/rubocop/formatter/disabled_config_formatter.rb:81:in `each'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.87.0/lib/rubocop/formatter/disabled_config_formatter.rb:81:in `output_offenses'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.87.0/lib/rubocop/formatter/disabled_config_formatter.rb:52:in `finished'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.87.0/lib/rubocop/formatter/formatter_set.rb:33:in `block (3 levels) in <class:FormatterSet>'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.87.0/lib/rubocop/formatter/formatter_set.rb:33:in `each'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.87.0/lib/rubocop/formatter/formatter_set.rb:33:in `block (2 levels) in <class:FormatterSet>'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.87.0/lib/rubocop/runner.rb:84:in `inspect_files'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.87.0/lib/rubocop/runner.rb:39:in `run'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.87.0/lib/rubocop/cli/command/execute_runner.rb:21:in `execute_runner'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.87.0/lib/rubocop/cli/command/execute_runner.rb:13:in `run'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.87.0/lib/rubocop/cli/command.rb:10:in `run'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.87.0/lib/rubocop/cli/environment.rb:17:in `run'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.87.0/lib/rubocop/cli/command/auto_genenerate_config.rb:102:in `execute_runner'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.87.0/lib/rubocop/cli/command/auto_genenerate_config.rb:80:in `run_all_cops'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.87.0/lib/rubocop/cli/command/auto_genenerate_config.rb:24:in `run'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.87.0/lib/rubocop/cli/command.rb:10:in `run'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.87.0/lib/rubocop/cli/environment.rb:17:in `run'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.87.0/lib/rubocop/cli.rb:65:in `run_command'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.87.0/lib/rubocop/cli.rb:70:in `execute_runners'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.87.0/lib/rubocop/cli.rb:41:in `run'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.87.0/exe/rubocop:13:in `block in <top (required)>'
.../.rbenv/versions/2.6.6/lib/ruby/2.6.0/benchmark.rb:308:in `realtime'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rubocop-0.87.0/exe/rubocop:12:in `<top (required)>'
.../.rbenv/versions/2.6.6/bin/rubocop:23:in `load'
.../.rbenv/versions/2.6.6/bin/rubocop:23:in `<top (required)>'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `load'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `kernel_load'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:28:in `run'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli.rb:476:in `exec'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor.rb:399:in `dispatch'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli.rb:30:in `dispatch'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/base.rb:476:in `start'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli.rb:24:in `start'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/exe/bundle:46:in `block in <top (required)>'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/friendly_errors.rb:123:in `with_friendly_errors'
.../.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/exe/bundle:34:in `<top (required)>'
.../.rbenv/versions/2.6.6/bin/bundle:23:in `load'
.../.rbenv/versions/2.6.6/bin/bundle:23:in `<main>'

.rubocop_todo.yml is still generated, but not complete. Starting anew with no todo file gives me the same behavior.

Steps to reproduce the problem

On my codebase, this is triggered when I use:

bundle exec rubocop --auto-gen-config

RuboCop version

$ bundle exec rubocop -v
0.87.0
@koic koic added the bug label Jul 7, 2020
@bbatsov bbatsov added this to the 1.0.0 milestone Jul 7, 2020
koic added a commit to koic/rubocop that referenced this issue Jul 7, 2020
…a cop without autocorrect

Fixes rubocop#8256.

This PR fixes an error for `--auto-gen-config` when running a cop who do not
support auto-correction.
bbatsov pushed a commit that referenced this issue Jul 7, 2020
…ithout autocorrect

Fixes #8256.

This PR fixes an error for `--auto-gen-config` when running a cop who do not
support auto-correction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants