Rubocop in VS Code

85 Views Asked by At

I'm a beginner in ruby on rails. I installed it and created a project. Then opened it in VS Code. But Rubocop didn't work. When I write in terminal "rubocop", I'm getting a message: "Rubocop found unknown Ruby version: 3.2". Then I tried to upgrade it to 1.59.0, but it didn't help. He gives the same error, and just as before the update, when checking the version, he writes 0.89.1

How I can fix it????

1

There are 1 best solutions below

1
akerr On

Do you have the gems 'rubocop' and 'rubocop-rails' added to your gemfile? There is also 'rubocop-rspec' that you can add for test files. Then you need a .rubocop.yml file that contains any specific rules as well as this to require it in your project:

require:
  - rubocop-rails
  - rubocop-rspec

See the configuration docs for more info. https://docs.rubocop.org/rubocop/configuration.html