Enable RuboCop

- RuboCop version is locked to 0.81.0 which supports Ruby 2.3
Once Ransack bumps the required_ruby_version, RuboCop can be bumped.

- `DisabledByDefault: true` not to apply all of default cops

- Some Layout and Style cops are enabled to make initial changes small
Other cops can be enabled later.
This commit is contained in:
Yasuo Honda 2020-12-22 22:51:46 +09:00
parent dc1c79ea74
commit b74842a067
2 changed files with 47 additions and 0 deletions

42
.rubocop.yml Normal file
View File

@ -0,0 +1,42 @@
AllCops:
# TargetRubyVersion value is based on `required_ruby_version = '>= 2.3'` in the ransack.gemspec
TargetRubyVersion: 2.3
DisabledByDefault: true
Layout/EmptyLineAfterMagicComment:
Enabled: true
Layout/EmptyLineBetweenDefs:
Enabled: true
Layout/EmptyLines:
Enabled: true
Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent
Layout/SpaceAfterComma:
Enabled: true
Layout/SpaceInsideBlockBraces:
Enabled: true
Layout/SpaceInsideHashLiteralBraces:
Enabled: true
Layout/SpaceInsideParens:
Enabled: true
Layout/TrailingEmptyLines:
Enabled: true
Style/RedundantReturn:
Enabled: true
Style/SelfAssignment:
Enabled: true
Style/Semicolon:
Enabled: true

View File

@ -49,3 +49,8 @@ group :test do
gem 'rspec', '~> 3'
gem 'simplecov', :require => false
end
# RuboCop 0.81.0 is the last version which supports Ruby 2.3.
# Once Ransack required_ruby_version is bumped, RuboCop version can be bumped.
# https://github.com/rubocop-hq/rubocop/pull/7869
gem 'rubocop', '=0.81.0', require: false