codeclimate / codeclimate-rubocop

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

Support rubocop-airbnb plugin #131

Open BernardoMG opened 6 years ago

BernardoMG commented 6 years ago

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?

wfleming commented 6 years ago

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.

BernardoMG commented 6 years ago

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

You can close this issue.

wfleming commented 6 years ago

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

modosc commented 6 years ago

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

modosc commented 6 years ago

would a pr help on this?

Manfred commented 5 years ago

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

andyw8 commented 5 years ago

@Manfred rubocop-rails is already supported:

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

andrewjking65 commented 4 years ago

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.

bmulholland commented 4 years ago

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

filipesperandio commented 4 years ago

@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.

bmulholland commented 3 years ago

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

mbajur commented 2 months ago

Any updates on this?

bmulholland commented 2 months ago

@mbajur CodeClimate hasn't been investing significant resources into their Quality product for many years. This project specifically hasn't been updated in 4 years. I wouldn't expect any fixes or improvements, and recommend migrating off CodeClimate Quality for something else. (I personally tried Codacy, found it had serious issues, and finally switched to using reviewdog + linters in PR checks on CI, which works well for us.)