Skip to content

Commit

Permalink
Bump TargetRubyVersion to 3.2
Browse files Browse the repository at this point in the history
Rails main branch requires Ruby 3.2.0, we can also update the RuboCop TargetRubyVersion to 3.2.
In Ruby 3.2, the Set class was made built-in, so it no longer requires require 'set'.

https://www.ruby-lang.org/en/news/2022/12/25/ruby-3-2-0-released/
> Set is now available as a builtin class without the need for require "set"

then it addresses the following `Lint/RedundantRequireStatement` not to run `require "set"`.
and removes the two extra lines after removing the `require "set"` manually.

```ruby
$ bundle exec rubocop -A
Inspecting 3324 files
... snip ...

Offenses:

actioncable/lib/action_cable/channel/base.rb:5:1: W: [Corrected] Lint/RedundantRequireStatement: Remove unnecessary require statement.
require "set"
^^^^^^^^^^^^^
... snip ...
tools/rail_inspector/lib/rail_inspector/visitor/attribute.rb:3:1: W: [Corrected] Lint/RedundantRequireStatement: Remove unnecessary require statement.
require "set"
^^^^^^^^^^^^^

3324 files inspected, 25 offenses detected, 25 offenses corrected
$
```

Follow up rails#53041
  • Loading branch information
yahonda committed Sep 27, 2024
1 parent 13d5f87 commit 2cfe83e
Show file tree
Hide file tree
Showing 26 changed files with 1 addition and 32 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require:
- rubocop-md

AllCops:
TargetRubyVersion: 3.1
TargetRubyVersion: 3.2
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
# to ignore them, so only the ones explicitly set in this file are enabled.
DisabledByDefault: true
Expand Down
1 change: 0 additions & 1 deletion actioncable/lib/action_cable/channel/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

# :markup: markdown

require "set"
require "active_support/rescuable"
require "active_support/parameter_filter"

Expand Down
2 changes: 0 additions & 2 deletions actioncable/lib/action_cable/connection/identification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

# :markup: markdown

require "set"

module ActionCable
module Connection
module Identification
Expand Down
1 change: 0 additions & 1 deletion actionmailer/test/base_test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

require "abstract_unit"
require "set"

require "action_dispatch"
require "active_support/time"
Expand Down
1 change: 0 additions & 1 deletion actionpack/lib/abstract_controller/rendering.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
require "abstract_controller/error"
require "action_view"
require "action_view/view_paths"
require "set"

module AbstractController
class DoubleRenderError < Error
Expand Down
2 changes: 0 additions & 2 deletions actionpack/lib/action_controller/metal/renderers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

# :markup: markdown

require "set"

module ActionController
# See Renderers.add
def self.add_renderer(key, &block)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
require "action_dispatch/http/upload"
require "rack/test"
require "stringio"
require "set"
require "yaml"

module ActionController
Expand Down
2 changes: 0 additions & 2 deletions actionview/lib/action_view/helpers/atom_feed_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require "set"

module ActionView
module Helpers # :nodoc:
# = Action View Atom Feed \Helpers
Expand Down
1 change: 0 additions & 1 deletion actionview/lib/action_view/helpers/tag_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
require "active_support/core_ext/enumerable"
require "active_support/core_ext/string/output_safety"
require "active_support/core_ext/string/inflections"
require "set"
require "action_view/helpers/capture_helper"
require "action_view/helpers/output_safety_helper"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

require "abstract_unit"
require "set"

module AbstractController
module Testing
Expand Down
2 changes: 0 additions & 2 deletions activejob/lib/active_job/serializers.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require "set"

module ActiveJob
# = Active Job \Serializers
#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require "set"

module ActiveRecord
module AttributeMethods
# = Active Record Attribute Methods Primary Key
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# frozen_string_literal: true

require "set"
require "active_record/connection_adapters/sql_type_metadata"
require "active_record/connection_adapters/abstract/schema_dumper"
require "active_record/connection_adapters/abstract/schema_creation"
Expand Down
1 change: 0 additions & 1 deletion activerecord/lib/active_record/fixtures.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

require "erb"
require "yaml"
require "set"
require "active_support/dependencies"
require "active_support/core_ext/digest/uuid"
require "active_record/test_fixtures"
Expand Down
1 change: 0 additions & 1 deletion activerecord/lib/active_record/migration.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# frozen_string_literal: true

require "set"
require "active_support/core_ext/array/access"
require "active_support/core_ext/enumerable"
require "active_support/core_ext/module/attribute_accessors"
Expand Down
2 changes: 0 additions & 2 deletions activesupport/lib/active_support/delegation.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require "set"

module ActiveSupport
# Error generated by +delegate+ when a method is called on +nil+ and +allow_nil+
# option is not used.
Expand Down
1 change: 0 additions & 1 deletion activesupport/lib/active_support/dependencies.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# frozen_string_literal: true

require "set"
require "active_support/dependencies/interlock"

module ActiveSupport # :nodoc:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
gem "listen", "~> 3.5"
require "listen"

require "set"
require "pathname"
require "concurrent/atomic/atomic_boolean"

Expand Down
1 change: 0 additions & 1 deletion activesupport/lib/active_support/notifications/fanout.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

require "concurrent/map"
require "set"
require "active_support/core_ext/object/try"

module ActiveSupport
Expand Down
1 change: 0 additions & 1 deletion activesupport/test/core_ext/class_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require_relative "../abstract_unit"
require "active_support/core_ext/class"
require "active_support/descendants_tracker"
require "set"

class ClassTest < ActiveSupport::TestCase
class Parent; end
Expand Down
1 change: 0 additions & 1 deletion activesupport/test/descendants_tracker_test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

require_relative "abstract_unit"
require "set"
require "active_support/descendants_tracker"

class DescendantsTrackerTest < ActiveSupport::TestCase
Expand Down
1 change: 0 additions & 1 deletion railties/lib/rails/application/bootstrap.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

require "fileutils"
require "set"
require "active_support/notifications"
require "active_support/dependencies"
require "active_support/descendants_tracker"
Expand Down
1 change: 0 additions & 1 deletion railties/lib/rails/application/finisher.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# frozen_string_literal: true

require "set"
require "active_support/core_ext/string/inflections"
require "active_support/core_ext/array/conversions"
require "active_support/descendants_tracker"
Expand Down
1 change: 0 additions & 1 deletion railties/test/application/configuration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require "isolation/abstract_unit"
require "rack/test"
require "env_helpers"
require "set"

class ::MyMailInterceptor
def self.delivering_email(email); email; end
Expand Down
1 change: 0 additions & 1 deletion railties/test/application/zeitwerk_integration_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# frozen_string_literal: true

require "set"
require "isolation/abstract_unit"

class ZeitwerkIntegrationTest < ActiveSupport::TestCase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# frozen_string_literal: true

require "set"
require "syntax_tree"

module RailInspector
Expand Down

0 comments on commit 2cfe83e

Please sign in to comment.