The Wizard
The Wizard

Reputation: 953

Is there a Rubocop configuration specifically for rails 5.2.3?

I have just created a fresh Rails application using Ruby 2.6.3 and Rails 5.2.3 and the only thing I have done is installed Rubocop.

After installing Rubocop v0.70.0, and running bundle exec rubocop I get 89 offences. After running rubocop -a to fix them automatically, I am still left with 34 offences. Is there a configuration I am missing for a rails project or will I need to manually fix these offences?

Upvotes: 2

Views: 716

Answers (1)

Vasfed
Vasfed

Reputation: 18454

Rails uses a code style that differs from rubocop default, but rubocop can be configured to enforce that.

For example see .rubocop.yml from rails itself, you can use that as a base for you own config, or use rubocop-rails_config gem (at time of writing it is not compatible with latest rubocop, but works fine with gem "rubocop", "0.67.2", just tested - with this config only a few autocorrectable issues are present in newly created rails app)

Upvotes: 1

Related Questions