codeclimate / codeclimate-rubocop

Code Climate Engine for Rubocop
MIT License
59 stars 43 forks source link

Add rubocop-rails #178

Closed Mange closed 5 years ago

Mange commented 5 years ago

When upgrading to Rubocop 0.70, this message is emitted:

Post-install message from rubocop: Rails cops will be removed from RuboCop 0.72. Use the rubocop-rails gem instead.

Put this in your Gemfile.

gem 'rubocop-rails'

And then execute:

$ bundle install

Put this into your .rubocop.yml.

require: rubocop-rails

More information: https://github.com/rubocop-hq/rubocop-rails

coding-bunny commented 5 years ago

I'm actually receiving the following when running something with 0.70:

/usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:117:in `require': cannot load such file -- rubocop-rails (LoadError)
    from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:117:in `require'
    from /usr/local/bundle/gems/rubocop-0.70.0/lib/rubocop/config_loader_resolver.rb:15:in `block in resolve_requires'
    from /usr/local/bundle/gems/rubocop-0.70.0/lib/rubocop/config_loader_resolver.rb:11:in `each'
    from /usr/local/bundle/gems/rubocop-0.70.0/lib/rubocop/config_loader_resolver.rb:11:in `resolve_requires'
    from /usr/local/bundle/gems/rubocop-0.70.0/lib/rubocop/config_loader.rb:45:in `load_file'
    from /usr/local/bundle/gems/rubocop-0.70.0/lib/rubocop/config_loader_resolver.rb:142:in `block in base_configs'
    from /usr/local/bundle/gems/rubocop-0.70.0/lib/rubocop/config_loader_resolver.rb:141:in `map'
    from /usr/local/bundle/gems/rubocop-0.70.0/lib/rubocop/config_loader_resolver.rb:141:in `base_configs'
    from /usr/local/bundle/gems/rubocop-0.70.0/lib/rubocop/config_loader_resolver.rb:22:in `resolve_inheritance'
    from /usr/local/bundle/gems/rubocop-0.70.0/lib/rubocop/config_loader.rb:50:in `load_file'
    from /usr/local/bundle/gems/rubocop-0.70.0/lib/rubocop/config_loader.rb:86:in `configuration_from_file'
    from /usr/local/bundle/gems/rubocop-0.70.0/lib/rubocop/config_store.rb:44:in `for'
    from /usr/src/app/lib/cc/engine/file_list_resolver.rb:38:in `rubocop_file_to_include?'
    from /usr/src/app/lib/cc/engine/file_list_resolver.rb:16:in `block in expanded_list'
    from /usr/src/app/lib/cc/engine/file_list_resolver.rb:13:in `each'
    from /usr/src/app/lib/cc/engine/file_list_resolver.rb:13:in `flat_map'
    from /usr/src/app/lib/cc/engine/file_list_resolver.rb:13:in `expanded_list'
    from /usr/src/app/lib/cc/engine/rubocop.rb:49:in `files_to_inspect'
    from /usr/src/app/lib/cc/engine/rubocop.rb:29:in `block in run'
    from /usr/src/app/lib/cc/engine/rubocop.rb:28:in `chdir'
    from /usr/src/app/lib/cc/engine/rubocop.rb:28:in `run'
    from /usr/src/app/bin/codeclimate-rubocop:17:in `<main>'

This worked fine yesterday, started today on a new PR

Mange commented 5 years ago

I've raised an issue with Codeclimate support about this.

filipesperandio commented 5 years ago

@Mange #188 merged, so closing this.

~@coding-bunny The error is not related to this issue, but was fixed #189~ My confusion with the other error...

modosc commented 5 years ago

this error is not fixed, we're still getting the problem on rubocop-0.70 (which was working previously)

filipesperandio commented 5 years ago

@modosc Which exact error are you seeing on channel/rubocop-0-70?

modosc commented 5 years ago
/usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:117:in `require': cannot load such file -- rubocop-rails (LoadError)
    from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:117:in `require'
    from /usr/local/bundle/gems/rubocop-0.70.0/lib/rubocop/config_loader_resolver.rb:15:in `block in resolve_requires'
    from /usr/local/bundle/gems/rubocop-0.70.0/lib/rubocop/config_loader_resolver.rb:11:in `each'
    from /usr/local/bundle/gems/rubocop-0.70.0/lib/rubocop/config_loader_resolver.rb:11:in `resolve_requires'
    from /usr/local/bundle/gems/rubocop-0.70.0/lib/rubocop/config_loader.rb:45:in `load_file'
    from /usr/local/bundle/gems/rubocop-0.70.0/lib/rubocop/config_loader.rb:86:in `configuration_from_file'
    from /usr/local/bundle/gems/rubocop-0.70.0/lib/rubocop/config_store.rb:44:in `for'
    from /usr/local/bundle/gems/rubocop-0.70.0/lib/rubocop/target_finder.rb:110:in `excluded_dirs'
    from /usr/local/bundle/gems/rubocop-0.70.0/lib/rubocop/target_finder.rb:88:in `find_files'
    from /usr/local/bundle/gems/rubocop-0.70.0/lib/rubocop/target_finder.rb:60:in `target_files_in_dir'
    from /usr/local/bundle/gems/rubocop-0.70.0/lib/rubocop/target_finder.rb:37:in `block in find'
    from /usr/local/bundle/gems/rubocop-0.70.0/lib/rubocop/target_finder.rb:35:in `each'
    from /usr/local/bundle/gems/rubocop-0.70.0/lib/rubocop/target_finder.rb:35:in `find'
    from /usr/local/bundle/gems/rubocop-0.70.0/lib/rubocop/runner.rb:64:in `find_target_files'
    from /usr/src/app/lib/cc/engine/file_list_resolver.rb:15:in `block in expanded_list'
    from /usr/src/app/lib/cc/engine/file_list_resolver.rb:13:in `each'
    from /usr/src/app/lib/cc/engine/file_list_resolver.rb:13:in `flat_map'
    from /usr/src/app/lib/cc/engine/file_list_resolver.rb:13:in `expanded_list'
    from /usr/src/app/lib/cc/engine/rubocop.rb:49:in `files_to_inspect'
    from /usr/src/app/lib/cc/engine/rubocop.rb:29:in `block in run'
    from /usr/src/app/lib/cc/engine/rubocop.rb:28:in `chdir'
    from /usr/src/app/lib/cc/engine/rubocop.rb:28:in `run'
    from /usr/src/app/bin/codeclimate-rubocop:17:in `<main>'

we're a paying customer, i can give you a link to the build too if you want?

filipesperandio commented 5 years ago

Just wanted to make sure... we merged the rubocop-rails into channel/rubocop-0-71 channel/rubocop-0-70 should work without the require: rubocop-rails entry but I think we can add the gem to that channel too and avoid confusion.

modosc commented 5 years ago

i just tried and i get the error on rubocop-0-71 as well. this is really impacting us - when can we expect this to be resolved?

filipesperandio commented 5 years ago

It is on the pipeline, will be live soon.

modosc commented 5 years ago

also interesting is that the rubocop-0-71 channel's stack trace seems to be using rubocop-0-70?

/usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:117:in `require': cannot load such file -- rubocop-rails (LoadError)
    from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:117:in `require'
    from /usr/local/bundle/gems/rubocop-0.70.0/lib/rubocop/config_loader_resolver.rb:15:in `block in resolve_requires'
modosc commented 5 years ago

ok, looks like both 70 and 71 are working for us now, thanks!

leonelgalan commented 4 years ago

Just wanted to make sure... we merged the rubocop-rails into channel/rubocop-0-71 channel/rubocop-0-70 should work without the require: rubocop-rails entry but I think we can add the gem to that channel too and avoid confusion.

Without this line, we won't be able to run Rails cops locally: rubocop . results in Warning: unrecognized cop Rails found in .rubocop.yml.


I just tried channel/rubocop-0-74 and I'm seeing the same "warning" on CodeClimate's output for the rubocop engine:

Warning: unrecognized cop Rails found in .rubocop.yml

I had the same issue with channel/rubocop-0-73 and channel/rubocop-0-72. I had to downgrade to channel/rubocop-0-71 to get rubocop-rails to work.


I just noticed that the Post-install message from rubocop:

Rails cops will be removed from RuboCop 0.72. Use the rubocop-rails gem instead.

That's why it's not working after 0.71.