prontolabs / pronto-rubocop

Pronto runner for Rubocop, ruby code analyzer
MIT License
80 stars 74 forks source link

pronto-rubocop breaking "undefined method `corrections'" #53

Closed alexhouse closed 3 years ago

alexhouse commented 3 years ago

Ref: https://github.com/rubocop-hq/rubocop/issues/8858

After a bit of an ignored hiatus we're trying to get pronto running again on one of our projects, including pronto-rubocop. It seems with recent updates (around June?) that pronto-rubocop hasn't been updated to handle the latest version yet as we're getting the following error when running it:

undefined method `corrections' for #<RuboCop::Cop::Corrector:0x00007fd594a4d758> (NoMethodError)

Full trace:

❯ bundle exec pronto run -c origin/master -r rubocop -f text
Traceback (most recent call last):
  30: from $HOME/.rvm/gems/ruby-2.7.1/bin/ruby_executable_hooks:24:in `<main>'
    29: from $HOME/.rvm/gems/ruby-2.7.1/bin/ruby_executable_hooks:24:in `eval'
    28: from $HOME/.rvm/gems/ruby-2.7.1/bin/pronto:23:in `<main>'
27: from $HOME/.rvm/gems/ruby-2.7.1/bin/pronto:23:in `load'
    26: from $HOME/.rvm/gems/ruby-2.7.1/gems/pronto-0.10.0/bin/pronto:6:in `<top (required)>'
    25: from $HOME/.rvm/gems/ruby-2.7.1/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
24: from $HOME/.rvm/gems/ruby-2.7.1/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
    23: from $HOME/.rvm/gems/ruby-2.7.1/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
    22: from $HOME/.rvm/gems/ruby-2.7.1/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
21: from $HOME/.rvm/gems/ruby-2.7.1/gems/pronto-0.10.0/lib/pronto/cli.rb:64:in `run'
    20: from $HOME/.rvm/gems/ruby-2.7.1/gems/pronto-0.10.0/lib/pronto/cli.rb:64:in `chdir'
    19: from $HOME/.rvm/gems/ruby-2.7.1/gems/pronto-0.10.0/lib/pronto/cli.rb:66:in `block in run'
18: from $HOME/.rvm/gems/ruby-2.7.1/gems/pronto-0.10.0/lib/pronto.rb:64:in `run'
    17: from $HOME/.rvm/gems/ruby-2.7.1/gems/pronto-0.10.0/lib/pronto/runners.rb:13:in `run'
    16: from $HOME/.rvm/gems/ruby-2.7.1/gems/pronto-0.10.0/lib/pronto/runners.rb:13:in `each'
15: from $HOME/.rvm/gems/ruby-2.7.1/gems/pronto-0.10.0/lib/pronto/runners.rb:20:in `block in run'
    14: from $HOME/.rvm/gems/ruby-2.7.1/bundler/gems/pronto-rubocop-dd3c6126d766/lib/pronto/rubocop.rb:11:in `run'
    13: from $HOME/.rvm/gems/ruby-2.7.1/bundler/gems/pronto-rubocop-dd3c6126d766/lib/pronto/rubocop.rb:11:in `flat_map'
12: from $HOME/.rvm/gems/ruby-2.7.1/bundler/gems/pronto-rubocop-dd3c6126d766/lib/pronto/rubocop.rb:11:in `each'
    11: from $HOME/.rvm/gems/ruby-2.7.1/bundler/gems/pronto-rubocop-dd3c6126d766/lib/pronto/rubocop.rb:11:in `block in run'
    10: from $HOME/.rvm/gems/ruby-2.7.1/bundler/gems/pronto-rubocop-dd3c6126d766/lib/pronto/rubocop/patch_cop.rb:14:in `messages'
9: from $HOME/.rvm/gems/ruby-2.7.1/bundler/gems/pronto-rubocop-dd3c6126d766/lib/pronto/rubocop/patch_cop.rb:14:in `flat_map'
     8: from $HOME/.rvm/gems/ruby-2.7.1/bundler/gems/pronto-rubocop-dd3c6126d766/lib/pronto/rubocop/patch_cop.rb:14:in `each'
     7: from $HOME/.rvm/gems/ruby-2.7.1/bundler/gems/pronto-rubocop-dd3c6126d766/lib/pronto/rubocop/patch_cop.rb:18:in `block in messages'
6: from $HOME/.rvm/gems/ruby-2.7.1/bundler/gems/pronto-rubocop-dd3c6126d766/lib/pronto/rubocop/patch_cop.rb:18:in `map'
     5: from $HOME/.rvm/gems/ruby-2.7.1/bundler/gems/pronto-rubocop-dd3c6126d766/lib/pronto/rubocop/patch_cop.rb:18:in `block (2 levels) in messages'
     4: from $HOME/.rvm/gems/ruby-2.7.1/bundler/gems/pronto-rubocop-dd3c6126d766/lib/pronto/rubocop/offense_line.rb:11:in `message'
3: from $HOME/.rvm/gems/ruby-2.7.1/bundler/gems/pronto-rubocop-dd3c6126d766/lib/pronto/rubocop/offense_line.rb:27:in `message_text'
     2: from $HOME/.rvm/gems/ruby-2.7.1/bundler/gems/pronto-rubocop-dd3c6126d766/lib/pronto/rubocop/offense_line.rb:34:in `suggestion_text'
     1: from $HOME/.rvm/gems/ruby-2.7.1/bundler/gems/pronto-rubocop-dd3c6126d766/lib/pronto/rubocop/offense_line.rb:45:in `corrections_count'
$HOME/.rvm/gems/ruby-2.7.1/bundler/gems/pronto-rubocop-dd3c6126d766/lib/pronto/rubocop/offense_line.rb:86:in `corrector': undefined method `corrections' for #<RuboCop::Cop::Corrector:0x00007fd594a4d758> (NoMethodError)

Tagging @marcandre as requested.

Versions

rubocop

0.92.0 (using Parser 2.7.2.0, rubocop-ast 0.7.1, running on ruby 2.7.1 x86_64-darwin19)

pronto

0.10.0 (running on ruby 2.7.1 x86_64-darwin19)
pronto-rubocop (0.10.0 dd3c612)
marcandre commented 3 years ago

I'll be glad to help, but I'd like a response to #50

sunny commented 3 years ago

Perhaps #51 fixes this for you. Can you try by using the master branch for pronto-rubocop?

alexhouse commented 3 years ago

Unfortunately not; even using master we still get the same error:

~/.rvm/gems/ruby-2.7.1/bundler/gems/pronto-rubocop-dd3c6126d766/lib/pronto/rubocop/offense_line.rb:86:in `corrector': undefined method `corrections' for #<RuboCop::Cop::Corrector:0x00007f982a3bed80> (NoMethodError)