Skip to content

Commit

Permalink
Support TargetRubyVersion 3.4 (experimental)
Browse files Browse the repository at this point in the history
RuboCop AST 1.31 supports Ruby 3.4.
rubocop/rubocop-ast#276

This PR supports `TargetRubyVersion 3.4`.
  • Loading branch information
koic committed Feb 29, 2024
1 parent 8acce28 commit 289aa56
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog/new_support_ruby_3_3_experimental.md
@@ -0,0 +1 @@
* [#12725](https://github.com/rubocop/rubocop/pull/12725): Support `TargetRubyVersion 3.4` (experimental). ([@koic][])
1 change: 1 addition & 0 deletions docs/modules/ROOT/pages/compatibility.adoc
Expand Up @@ -35,6 +35,7 @@ The following table is the runtime support matrix.
| 3.1 | -
| 3.2 | -
| 3.3 | -
| 3.4 (experimental) | -
|===

RuboCop targets Ruby 2.0+ code analysis since RuboCop 1.30. It restored code analysis support that had been removed earlier by mistake, together with dropping runtime support for unsupported Ruby versions.
Expand Down
4 changes: 4 additions & 0 deletions lib/rubocop/rspec/shared_contexts.rb
Expand Up @@ -185,3 +185,7 @@ def source_range(range, buffer: source_buffer)
RSpec.shared_context 'ruby 3.3' do
let(:ruby_version) { 3.3 }
end

RSpec.shared_context 'ruby 3.4' do
let(:ruby_version) { 3.4 }
end
2 changes: 1 addition & 1 deletion lib/rubocop/target_ruby.rb
Expand Up @@ -4,7 +4,7 @@ module RuboCop
# The kind of Ruby that code inspected by RuboCop is written in.
# @api private
class TargetRuby
KNOWN_RUBIES = [2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2, 3.3].freeze
KNOWN_RUBIES = [2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2, 3.3, 3.4].freeze
DEFAULT_VERSION = 2.7

OBSOLETE_RUBIES = {
Expand Down
2 changes: 1 addition & 1 deletion rubocop.gemspec
Expand Up @@ -38,7 +38,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency('rainbow', '>= 2.2.2', '< 4.0')
s.add_runtime_dependency('regexp_parser', '>= 1.8', '< 3.0')
s.add_runtime_dependency('rexml', '>= 3.2.5', '< 4.0')
s.add_runtime_dependency('rubocop-ast', '>= 1.30.0', '< 2.0')
s.add_runtime_dependency('rubocop-ast', '>= 1.31.0', '< 2.0')
s.add_runtime_dependency('ruby-progressbar', '~> 1.7')
s.add_runtime_dependency('unicode-display_width', '>= 2.4.0', '< 3.0')
end
2 changes: 1 addition & 1 deletion spec/rubocop/cli_spec.rb
Expand Up @@ -1903,7 +1903,7 @@ def method(foo, bar, qux, fred, arg5, f) end #{'#' * 85}
'Error: RuboCop found unknown Ruby version 4.0 in `TargetRubyVersion`'
)
expect($stderr.string.strip).to match(
/Supported versions: 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2, 3.3/
/Supported versions: 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2, 3.3, 3.4/
)
end
end
Expand Down

0 comments on commit 289aa56

Please sign in to comment.