From b74842a0679ef920375589fa8710f1a316dd3747 Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Tue, 22 Dec 2020 22:51:46 +0900 Subject: [PATCH] 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. --- .rubocop.yml | 42 ++++++++++++++++++++++++++++++++++++++++++ Gemfile | 5 +++++ 2 files changed, 47 insertions(+) create mode 100644 .rubocop.yml diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..c5d3610 --- /dev/null +++ b/.rubocop.yml @@ -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 + diff --git a/Gemfile b/Gemfile index ea198d7..633fd2e 100644 --- a/Gemfile +++ b/Gemfile @@ -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