Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

RuboCop 0.72.0 removed -R option, causing Rails linting to fail #598

Open
skipkayhil opened this issue Apr 1, 2020 · 9 comments
Open

RuboCop 0.72.0 removed -R option, causing Rails linting to fail #598

skipkayhil opened this issue Apr 1, 2020 · 9 comments
Labels
bug Bug reports

Comments

@skipkayhil
Copy link

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.

@jordanbrock
Copy link

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.

@jordanbrock
Copy link

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.

@abraham-chan
Copy link

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

@github-actions
Copy link

github-actions bot commented Aug 8, 2020

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

@github-actions github-actions bot added the stale label Aug 8, 2020
@skipkayhil
Copy link
Author

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

@github-actions github-actions bot removed the stale label Aug 11, 2020
@github-actions
Copy link

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

@jhirn
Copy link

jhirn commented Oct 25, 2021

This still an actual problem. Experienced it today. Using rails: true in the linter config add -R. I think this option should be removed entirely. The recommended way to include rails cops should come from rubocop.yml, not the linter configuration.

@estiens
Copy link

estiens commented Feb 9, 2022

still a problem

@lockieRichter
Copy link

lockieRichter commented Apr 18, 2023

Still seeing this issue more than a year later, currently using #598 (comment) as a workaround!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bug reports
Projects
None yet
Development

No branches or pull requests

7 participants