Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for Ruby 2.3 #7869

Merged
merged 1 commit into from Apr 12, 2020
Merged

Conversation

koic
Copy link
Member

@koic koic commented Apr 12, 2020

Summary

This PR drops support for Ruby 2.3.

It is discussed in #6945.
And this suggestion would mean that RuboCop 1.0 (and pre-release) requires Ruby 2.4 or higher.

The following is a plan after this PR.
There was a build error report for a dependent jaro_winkler gem.
#5989, #6754, #7447, and #7564. And #7673 was trying to solve it.

After dropping Ruby 2.3, replace jaro_winkler with did_you_mean.
did_you_mean is written in Ruby, so the build error due to native extensions no longer occur. That change opens as anther PR.

Other Information

The latest did_you_mean (1.4.0) supports Ruby 2.5 or higher, so it needs to be confirmed old versions it works with Ruby 2.4.


Before submitting the PR make sure the following are checked:

  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Run bundle exec rake default. It executes all tests and RuboCop for itself, and generates the documentation.

### Summary

This PR drops support for Ruby 2.3.

It is discussed in rubocop#6945.
And this suggestion would mean that RuboCop 1.0 (and pre-release)
requires Ruby 2.4 or higher.

The following is a plan after this PR.
There was a build error report for a dependent jaro_winkler gem.
rubocop#5989, rubocop#6754, rubocop#7447, and rubocop#7564. And rubocop#7673 was trying to solve it.

After dropping Ruby 2.3, replace jaro_winkler with did_you_mean.
did_you_mean is written in Ruby, so the build error due to native
extensions no longer occur. That change opens as anther PR.

### Other Information

The latest did_you_mean (1.4.0) supports Ruby 2.5 or higher,
so it needs to be confirmed old versions it works with Ruby 2.4.
@bbatsov bbatsov merged commit 5873894 into rubocop:master Apr 12, 2020
@bbatsov
Copy link
Collaborator

bbatsov commented Apr 12, 2020

Great work! Thanks!

After dropping Ruby 2.3, replace jaro_winkler with did_you_mean.
did_you_mean is written in Ruby, so the build error due to native extensions no longer occur. That change opens as anther PR.

I love the plan!

@koic koic deleted the drop_support_for_ruby_2_3 branch April 12, 2020 22:03
koic added a commit to koic/rubocop-minitest that referenced this pull request Apr 13, 2020
koic added a commit to koic/rubocop-minitest that referenced this pull request Apr 13, 2020
koic added a commit to koic/rubocop-rails that referenced this pull request Apr 13, 2020
koic added a commit to koic/rubocop-performance that referenced this pull request Apr 13, 2020
koic added a commit to koic/rubocop-rails that referenced this pull request Apr 13, 2020
koic added a commit that referenced this pull request Apr 13, 2020
Follow up of #7869.
koic added a commit to koic/rubocop that referenced this pull request Apr 13, 2020
Follow rubocop#7384, rubocop#7857, and rubocop#7869.

This PR fixes the next release version with 0.82 because RuboCop 0.81
has been released. This version (0.82) is based on rubocop#7851.
@koic koic mentioned this pull request Apr 13, 2020
8 tasks
@DirtyF
Copy link

DirtyF commented Apr 13, 2020

Question: what is Rubocop policy against current maintained Ruby versions? Given 2.4 is EOL now, when will Rubocop drop 2.4 support?

yahonda added a commit to yahonda/ransack that referenced this pull request Dec 28, 2020
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index ea88908..468bc7f 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -21,7 +21,7 @@ jobs:
           - 2.6.6
     env:
       DB: sqlite3
-      RAILS: ${{ matrix.rails }}
+      BUNDLE_GEMFILE: gemfiles/Gemfile.${{ matrix.rails }}
     steps:
       - uses: actions/checkout@v2
       - name: Set up Ruby
@@ -49,7 +49,7 @@ jobs:
           - 2.6.6
     env:
       DB: mysql
-      RAILS: ${{ matrix.rails }}
+      BUNDLE_GEMFILE: gemfiles/Gemfile.${{ matrix.rails }}
       MYSQL_USERNAME: root
       MYSQL_PASSWORD: root
     steps:
@@ -86,7 +86,7 @@ jobs:
           - 2.6.6
     env:
       DB: postgres
-      RAILS: ${{ matrix.rails }}
+      BUNDLE_GEMFILE: gemfiles/Gemfile.${{ matrix.rails }}
       DATABASE_USERNAME: postgres
       DATABASE_PASSWORD: postgres
       DATABASE_HOST: 127.0.0.1
diff --git a/Gemfile b/Gemfile
index 5bab691..98e8c00 100644
--- a/Gemfile
+++ b/Gemfile
@@ -2,47 +2,19 @@ source 'https://rubygems.org'
 gemspec

 gem 'rake'
-
-rails = ENV['RAILS'] || '6-0-stable'
-
-rails_version = case rails
-                when /\// # A path
-                  File.read(File.join(rails, "RAILS_VERSION"))
-                when /^v/ # A tagged version
-                  rails.gsub(/^v/, '')
-                else
-                  rails
-                end
-
 gem 'faker', '~> 1.0'
-gem 'sqlite3', ::Gem::Version.new(rails_version) >= ::Gem::Version.new('6-0-stable') ? '~> 1.4.1' : '~> 1.3.3'
+gem 'sqlite3', '~> 1.4.1'
 gem 'pg', '~> 1.0'
+gem 'mysql2', '~> 0.5.2'
 gem 'pry', '~> 0.12.2'
 gem 'byebug'

-case rails
-when /\// # A path
-  gem 'activesupport', path: "#{rails}/activesupport"
-  gem 'activemodel', path: "#{rails}/activemodel"
-  gem 'activerecord', path: "#{rails}/activerecord", require: false
-  gem 'actionpack', path: "#{rails}/actionpack"
-  gem 'actionview', path: "#{rails}/actionview"
-when /^v/ # A tagged version
-  git 'https://github.com/rails/rails.git', :tag => rails do
-    gem 'activesupport'
-    gem 'activemodel'
-    gem 'activerecord', require: false
-    gem 'actionpack'
-  end
-else
-  git 'https://github.com/rails/rails.git', :branch => rails do
-    gem 'activesupport'
-    gem 'activemodel'
-    gem 'activerecord', require: false
-    gem 'actionpack'
-  end
+git 'https://github.com/rails/rails.git', :branch => 'master' do
+  gem 'activesupport'
+  gem 'activemodel'
+  gem 'activerecord', require: false
+  gem 'actionpack'
 end
-gem 'mysql2', '~> 0.5.2'

 group :test do
   gem 'machinist', '~> 1.0.6'
diff --git a/gemfiles/Gemfile.5-2-stable b/gemfiles/Gemfile.5-2-stable
new file mode 100644
index 0000000..9a2864d
--- /dev/null
+++ b/gemfiles/Gemfile.5-2-stable
@@ -0,0 +1,33 @@
+source 'https://rubygems.org'
+gemspec path: "../"
+
+gem 'rake'
+gem 'faker', '~> 1.0'
+gem 'sqlite3', '~> 1.3.3'
+gem 'pg', '~> 1.0'
+gem 'mysql2', '~> 0.5.2'
+gem 'pry', '~> 0.12.2'
+gem 'byebug'
+
+git 'https://github.com/rails/rails.git', :branch => '5-2-stable' do
+  gem 'activesupport'
+  gem 'activemodel'
+  gem 'activerecord', require: false
+  gem 'actionpack'
+end
+
+group :test do
+  gem 'machinist', '~> 1.0.6'
+  gem 'rspec', '~> 3'
+  gem 'simplecov', :require => false
+end
+
+group :rubocop do
+  # 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.
+  # rubocop/rubocop#7869
+  gem 'rubocop', '=0.81.0', require: false
+end
+
+
+
diff --git a/gemfiles/Gemfile.6-0-stable b/gemfiles/Gemfile.6-0-stable
new file mode 100644
index 0000000..4c35394
--- /dev/null
+++ b/gemfiles/Gemfile.6-0-stable
@@ -0,0 +1,33 @@
+source 'https://rubygems.org'
+gemspec path: "../"
+
+gem 'rake'
+gem 'faker', '~> 1.0'
+gem 'sqlite3', '~> 1.4.1'
+gem 'pg', '~> 1.0'
+gem 'mysql2', '~> 0.5.2'
+gem 'pry', '~> 0.12.2'
+gem 'byebug'
+
+git 'https://github.com/rails/rails.git', :branch => '6-0-stable' do
+  gem 'activesupport'
+  gem 'activemodel'
+  gem 'activerecord', require: false
+  gem 'actionpack'
+end
+
+group :test do
+  gem 'machinist', '~> 1.0.6'
+  gem 'rspec', '~> 3'
+  gem 'simplecov', :require => false
+end
+
+group :rubocop do
+  # 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.
+  # rubocop/rubocop#7869
+  gem 'rubocop', '=0.81.0', require: false
+end
+
+
+
diff --git a/gemfiles/Gemfile.v5.2.4 b/gemfiles/Gemfile.v5.2.4
new file mode 100644
index 0000000..e49be0d
--- /dev/null
+++ b/gemfiles/Gemfile.v5.2.4
@@ -0,0 +1,33 @@
+source 'https://rubygems.org'
+gemspec path: "../"
+
+gem 'rake'
+gem 'faker', '~> 1.0'
+gem 'sqlite3', '~> 1.3.3'
+gem 'pg', '~> 1.0'
+gem 'mysql2', '~> 0.5.2'
+gem 'pry', '~> 0.12.2'
+gem 'byebug'
+
+git 'https://github.com/rails/rails.git', :tag => 'v5.2.4' do
+  gem 'activesupport'
+  gem 'activemodel'
+  gem 'activerecord', require: false
+  gem 'actionpack'
+end
+
+group :test do
+  gem 'machinist', '~> 1.0.6'
+  gem 'rspec', '~> 3'
+  gem 'simplecov', :require => false
+end
+
+group :rubocop do
+  # 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.
+  # rubocop/rubocop#7869
+  gem 'rubocop', '=0.81.0', require: false
+end
+
+
+
diff --git a/gemfiles/Gemfile.v6.0.3 b/gemfiles/Gemfile.v6.0.3
new file mode 100644
index 0000000..89995d6
--- /dev/null
+++ b/gemfiles/Gemfile.v6.0.3
@@ -0,0 +1,33 @@
+source 'https://rubygems.org'
+gemspec path: "../"
+
+gem 'rake'
+gem 'faker', '~> 1.0'
+gem 'sqlite3', '~> 1.4.1'
+gem 'pg', '~> 1.0'
+gem 'mysql2', '~> 0.5.2'
+gem 'pry', '~> 0.12.2'
+gem 'byebug'
+
+git 'https://github.com/rails/rails.git', :tag => 'v6.0.3' do
+  gem 'activesupport'
+  gem 'activemodel'
+  gem 'activerecord', require: false
+  gem 'actionpack'
+end
+
+group :test do
+  gem 'machinist', '~> 1.0.6'
+  gem 'rspec', '~> 3'
+  gem 'simplecov', :require => false
+end
+
+group :rubocop do
+  # 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.
+  # rubocop/rubocop#7869
+  gem 'rubocop', '=0.81.0', require: false
+end
+
+
+
diff --git a/gemfiles/Gemfile.v6.1.0 b/gemfiles/Gemfile.v6.1.0
new file mode 100644
index 0000000..c3224b7
--- /dev/null
+++ b/gemfiles/Gemfile.v6.1.0
@@ -0,0 +1,33 @@
+source 'https://rubygems.org'
+gemspec path: "../"
+
+gem 'rake'
+gem 'faker', '~> 1.0'
+gem 'sqlite3', '~> 1.4.1'
+gem 'pg', '~> 1.0'
+gem 'mysql2', '~> 0.5.2'
+gem 'pry', '~> 0.12.2'
+gem 'byebug'
+
+git 'https://github.com/rails/rails.git', :tag => 'v6.1.0' do
+  gem 'activesupport'
+  gem 'activemodel'
+  gem 'activerecord', require: false
+  gem 'actionpack'
+end
+
+group :test do
+  gem 'machinist', '~> 1.0.6'
+  gem 'rspec', '~> 3'
+  gem 'simplecov', :require => false
+end
+
+group :rubocop do
+  # 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.
+  # rubocop/rubocop#7869
+  gem 'rubocop', '=0.81.0', require: false
+end
+
+
+
koic added a commit to koic/rubocop that referenced this pull request May 16, 2022
Follow up rubocop#10632 (comment).

Reverts part of rubocop#7869 and rubocop#8056.

Only the Ruby version (2.3) to runtime should have been dropped, not
code analysis.
This PR makes Ruby 2.3 code analysis with `TargetRubyVersion: 2.3`.
It aims to solve essentially the same problem as rubocop#10626 and 10632.

And this change requires RuboCop AST 1.18 or later:
rubocop/rubocop-ast#233
renawatson68 added a commit to renawatson68/performance-develop-rubyonrails that referenced this pull request Sep 23, 2022
richardstewart0213 added a commit to richardstewart0213/performance-build-Performance-optimization-analysis- that referenced this pull request Nov 4, 2022
MarttiCheng added a commit to MarttiCheng/Rubocop-Performance that referenced this pull request Sep 28, 2023
SerhiiMisiura added a commit to SerhiiMisiura/Rubocop-Performance that referenced this pull request Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants