From f571a9685cc4dd34e4de5d2e7478931700c9473e Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Tue, 6 Apr 2021 19:02:00 +0900 Subject: [PATCH] Drop Ruby 2.4 support Follow https://github.com/rubocop/rubocop/pull/9648. --- .circleci/config.yml | 3 --- .rubocop.yml | 2 +- CHANGELOG.md | 1 + .../rails/attribute_default_block_value.rb | 2 +- rubocop-rails.gemspec | 2 +- tasks/cops_documentation.rake | 20 +++++++++---------- 6 files changed, 13 insertions(+), 17 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index df78d9f862..363333f782 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -38,9 +38,6 @@ workflows: build: jobs: - documentation-checks - - rake_default: - name: Ruby 2.4 - image: circleci/ruby:2.4 - rake_default: name: Ruby 2.5 image: circleci/ruby:2.5 diff --git a/.rubocop.yml b/.rubocop.yml index 5a2909703e..48baf467ec 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -13,7 +13,7 @@ AllCops: - 'vendor/**/*' - 'spec/fixtures/**/*' - 'tmp/**/*' - TargetRubyVersion: 2.4 + TargetRubyVersion: 2.5 SuggestExtensions: false InternalAffairs/NodeMatcherDirective: diff --git a/CHANGELOG.md b/CHANGELOG.md index f572f1650c..a53a62c2a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ * [#381](https://github.com/rubocop/rubocop-rails/pull/381): Update `IgnoredMethods` list for `Lint/NumberConversion` to allow Rails' duration methods. ([@dvandersluis][]) * [#444](https://github.com/rubocop/rubocop-rails/issues/444): Mark `Rails/Blank` as unsafe auto-correction. ([@koic][]) * [#451](https://github.com/rubocop/rubocop-rails/issues/451): Make `Rails/RelativeDateConstant` aware of `yesterday` and `tomorrow` methods. ([@koic][]) +* [#456](https://github.com/rubocop/rubocop-rails/pull/456): Drop Ruby 2.4 support. ([@koic][]) ## 2.9.1 (2020-12-16) diff --git a/lib/rubocop/cop/rails/attribute_default_block_value.rb b/lib/rubocop/cop/rails/attribute_default_block_value.rb index 617af042bb..2651f981b8 100644 --- a/lib/rubocop/cop/rails/attribute_default_block_value.rb +++ b/lib/rubocop/cop/rails/attribute_default_block_value.rb @@ -75,7 +75,7 @@ class AttributeDefaultBlockValue < Base def on_send(node) default_attribute(node) do |attribute| value = attribute.children.last - return unless TYPE_OFFENDERS.any? { |type| value.type == type } + return unless TYPE_OFFENDERS.any?(value.type) add_offense(value) do |corrector| expression = default_attribute(node).children.last diff --git a/rubocop-rails.gemspec b/rubocop-rails.gemspec index 8e12c671a8..3eee62c466 100644 --- a/rubocop-rails.gemspec +++ b/rubocop-rails.gemspec @@ -8,7 +8,7 @@ Gem::Specification.new do |s| s.name = 'rubocop-rails' s.version = RuboCop::Rails::Version::STRING s.platform = Gem::Platform::RUBY - s.required_ruby_version = '>= 2.4.0' + s.required_ruby_version = '>= 2.5.0' s.authors = ['Bozhidar Batsov', 'Jonas Arvidsson', 'Yuji Nakayama'] s.description = <<~DESCRIPTION Automatic Rails code style checking tool. diff --git a/tasks/cops_documentation.rake b/tasks/cops_documentation.rake index 8b248eba63..d50647cd7b 100644 --- a/tasks/cops_documentation.rake +++ b/tasks/cops_documentation.rake @@ -46,17 +46,15 @@ task documentation_syntax_check: :yard_for_generate_documentation do end examples.to_a.each do |example| - begin - buffer = Parser::Source::Buffer.new('', 1) - buffer.source = example.text - parser = Parser::Ruby25.new(RuboCop::AST::Builder.new) - parser.diagnostics.all_errors_are_fatal = true - parser.parse(buffer) - rescue Parser::SyntaxError => e - path = example.object.file - puts "#{path}: Syntax Error in an example. #{e}" - ok = false - end + buffer = Parser::Source::Buffer.new('', 1) + buffer.source = example.text + parser = Parser::Ruby25.new(RuboCop::AST::Builder.new) + parser.diagnostics.all_errors_are_fatal = true + parser.parse(buffer) + rescue Parser::SyntaxError => e + path = example.object.file + puts "#{path}: Syntax Error in an example. #{e}" + ok = false end end abort unless ok