Rubocop is a code analyzer and code formatter. This tool will apply recommended guidelines from the ([Ruby Style Guide])(https://github.com/rubocop-hq/ruby-style-guide). We encourage all Rails projects to adopt this tool.
inherit_from: .rubocop_todo.yml
require:
- rubocop-rspec
- rubocop-performance
Rails:
Enabled: true
Style/FrozenStringLiteralComment:
EnforcedStyle: never
Style/StringLiterals:
EnforcedStyle: double_quotes
Style/HashSyntax:
EnforcedStyle: ruby19
Layout/IndentationConsistency:
EnforcedStyle: rails
Layout/CaseIndentation:
EnforcedStyle: end
Layout/BlockAlignment:
Enabled: false
Layout/EndAlignment:
EnforcedStyleAlignWith: start_of_line
AllCops:
Exclude:
- 'vendor/**/*'
- 'node_modules/**/*'
- 'db/migrate/*'
- 'db/schema.rb'
- 'db/seeds.rb'
- 'bin/*'
TargetRubyVersion: 2.6.0
Make sure that TargetRubyVersion
is the latest Ruby version.
Performance cops have been removed in Rubocop 0.68. To use them, require rubocop-performance
and add rubocop-performance
to your gemfile.
You don't need rubocop-rspec
if your project is using minitest.
Try to fix all the issues reported in the .rubocop_todo.yml
file. Treat it as a proper TODO
and not a hack to avoid rubocop warnings or errors.