codeclimate-rubocop icon indicating copy to clipboard operation
codeclimate-rubocop copied to clipboard

Support rubocop-airbnb plugin

Open BernardoMG opened this issue 7 years ago • 13 comments

I'm trying to add codeclimate.yml but I'm having problems with rubocop engine.

This is my codeclimate.yml:

version: 2 # required to adjust maintainability checks

checks:
  argument-count:
    enabled: true

complex-logic:
  enabled: true

file-lines:
  enabled: true

identical-code:
  enabled: true

method-complexity:
  enabled: true

method-count:
  enabled: true

method-lines:
  enabled: true

nested-control-flow:
  enabled: true

return-statements:
  enabled: true

similar-code:
  enabled: true

exclude_patterns:
 - "config/"
 - "db/"
 - "**/node_modules/"
 - "**/vendor/"
 - "**/*_test.go"
 - "**/*.d.ts"

plugins:
  brakeman:
    enabled: true

  csslint:
    enabled: true

  eslint:
    enabled: true
    config:
      config: .eslintrc

  reek:
    enabled: true

  rubocop:
    enabled: true
    config:
      file: .rubocop.yml

  scss-lint:
    enabled: true

And this is my rubocop.yml:

require: rubocop-airbnb

inherit_from: .rubocop_airbnb.yml

I have installed rubocop-airbnb gem (Source) and its declared on my Gemfile.

Running codeclimage analyze gives the following output:

/usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:122:in `require': cannot load such file -- rubocop-airbnb (LoadError)
	from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:122:in `require'
	from /usr/local/bundle/gems/rubocop-0.52.1/lib/rubocop/config_loader_resolver.rb:15:in `block in resolve_requires'
	from /usr/local/bundle/gems/rubocop-0.52.1/lib/rubocop/config_loader_resolver.rb:11:in `each'
	from /usr/local/bundle/gems/rubocop-0.52.1/lib/rubocop/config_loader_resolver.rb:11:in `resolve_requires'
	from /usr/local/bundle/gems/rubocop-0.52.1/lib/rubocop/config_loader.rb:38:in `load_file'
	from /usr/local/bundle/gems/rubocop-0.52.1/lib/rubocop/config_store.rb:23:in `options_config='
	from /usr/src/app/lib/cc/engine/rubocop.rb:55:in `block in config_store'
	from /usr/src/app/lib/cc/engine/rubocop.rb:53:in `tap'
	from /usr/src/app/lib/cc/engine/rubocop.rb:53:in `config_store'
	from /usr/src/app/lib/cc/engine/rubocop.rb:46: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>'

Any ideas about this?

BernardoMG avatar Aug 27 '18 11:08 BernardoMG

Code Climate plugins run in isolated environments and can't install gems or use gems installed for the repositories they're analyzing. This is a security feature that does unfortunately limit the flexibility of plugins to use their own third party plugins.

In some cases we do package libraries like this along with the plugin, we may be able to consider doing that in this case.

wfleming avatar Aug 27 '18 15:08 wfleming

Thanks for the help @wfleming! It would be awesome if you consider to package this library into the plugin.

You can close this issue.

BernardoMG avatar Aug 27 '18 16:08 BernardoMG

I'll leave it open to track the desire to support the gem, thanks for getting back to me.

wfleming avatar Aug 27 '18 19:08 wfleming

just came to open the same ticket - having the matching rubocop-airbnb package installed alongside rubocop would be awesome.

modosc avatar Sep 07 '18 18:09 modosc

would a pr help on this?

modosc avatar Oct 29 '18 18:10 modosc

Lots of people will soon have the same problem with rubocop-rails.

Manfred avatar Jul 10 '19 09:07 Manfred

@Manfred rubocop-rails is already supported:

https://github.com/codeclimate/codeclimate-rubocop/issues/178

andyw8 avatar Jul 11 '19 01:07 andyw8

Any movement on this? My team is using the Airbnb Rubocop standard to develop and code climate as a part of our CI. Not being able to add this third party plugin means our CI rubocop is on a different standard than our local dev one which isn’t really tenable.

andrewjking65 avatar Apr 10 '20 16:04 andrewjking65

@filipesperandio would you accept a PR that adds rubocop-airbnb?

bmulholland avatar Sep 01 '20 14:09 bmulholland

@filipesperandio would you accept a PR that adds rubocop-airbnb?

sorry, missed this.

@britneywright just looked into it and found some possible mismatches regarding different versions on both sides. Maybe we can do this in an specific channel, as she suggested.

filipesperandio avatar Oct 28 '20 17:10 filipesperandio

Just to cross-post, I submitted a PR to upgrade packages in rubocop-airbnb that may help this along: https://github.com/airbnb/ruby/pull/178

bmulholland avatar Dec 02 '20 17:12 bmulholland