Vscode-ruby: RuboCop 0.72.0 removed -R option, causing Rails linting to fail

Created on 1 Apr 2020  路  6Comments  路  Source: rubyide/vscode-ruby

Your environment

  • vscode-ruby version: 0.27.0
  • Ruby version: any
  • Ruby version manager (if any): asdf
  • VS Code version: 1.43.2
  • Operating System: macOS 10.14.6
  • Using language server? (eg useLanguageServer is true in your configuration?) Yes
  • RuboCop version: >0.72.0

Expected behavior

"ruby.lint": {
    "rubocop": {
      "lint": true,
      "rails": true
    }
  },

Adding this to my configuration should enable linting with rubocop, with rails cops enabled.

Actual behavior

Language Server Output:

Lint: executing rubocop -s <file> -f json -R -l...
invalid option: -R

RuboCop Changelog

The new way to use rails cops is to install the rubocop-rails gem and run RuboCop with rubocop --require rubocop-rails

I can make a PR for this to swap out the argument, but to maintain compatibility with older rubocops it may become more complicated.

bug

Most helpful comment

@jordanbrock Here's what I did to get linting working with rubocop >0.71

All 6 comments

Is there a config file based workaround for this in the meantime?

I've tried downgrading to 0.71 but it throws a few requirement errors for some other gems.

Actually, got it working with a mix of older gem versions:

  gem "rubocop", "0.71"
  gem "rubocop-rails", git: "https://github.com/rubocop-hq/rubocop-rails", tag: "v2.0.1"

But obviously, support for the latest versions would be preferred. I'm new to VSCode, so I'll have a poke around how extensions work and see if I can muddle a PR together at some point.

@jordanbrock Here's what I did to get linting working with rubocop >0.71

This issue has not had activity for 30 days. It will be automatically closed in 7 days.

I can make a PR to update the docs later this week with the suggestion from @abraham-chan

This issue has not had activity for 30 days. It will be automatically closed in 7 days.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rebornix picture rebornix  路  3Comments

abraham picture abraham  路  4Comments

ckruse picture ckruse  路  5Comments

webmastak picture webmastak  路  4Comments

wingrunr21 picture wingrunr21  路  4Comments