Skip to content

Commit

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

This PR supports `TargetRubyVersion 3.2`.
  • Loading branch information
koic committed Feb 22, 2022
1 parent ec581bb commit de67909
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_2_experimental.md
@@ -0,0 +1 @@
* [#10433](https://github.com/rubocop/rubocop/pull/10433): Support `TargetRubyVersion 3.2` (experimental). ([@koic][])
1 change: 1 addition & 0 deletions docs/modules/ROOT/pages/compatibility.adoc
Expand Up @@ -32,6 +32,7 @@ The following table is the support matrix.
| 2.7 | -
| 3.0 | -
| 3.1 | -
| 3.2 (experimental) | -
|===

NOTE: The compatibility xref:configuration.adoc#setting-the-target-ruby-version[target Ruby version mentioned here] is about code analysis (what RuboCop can analyze), not runtime (is RuboCop capable of running on some Ruby or not).
Expand Down
4 changes: 4 additions & 0 deletions lib/rubocop/rspec/shared_contexts.rb
Expand Up @@ -135,3 +135,7 @@ def source_range(range, buffer: source_buffer)
RSpec.shared_context 'ruby 3.1', :ruby31 do
let(:ruby_version) { 3.1 }
end

RSpec.shared_context 'ruby 3.2', :ruby32 do
let(:ruby_version) { 3.2 }
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.5, 2.6, 2.7, 3.0, 3.1].freeze
KNOWN_RUBIES = [2.5, 2.6, 2.7, 3.0, 3.1, 3.2].freeze
DEFAULT_VERSION = KNOWN_RUBIES.first

OBSOLETE_RUBIES = {
Expand Down
2 changes: 1 addition & 1 deletion rubocop.gemspec
Expand Up @@ -36,7 +36,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')
s.add_runtime_dependency('rubocop-ast', '>= 1.15.1', '< 2.0')
s.add_runtime_dependency('rubocop-ast', '>= 1.16.0', '< 2.0')
s.add_runtime_dependency('ruby-progressbar', '~> 1.7')
s.add_runtime_dependency('unicode-display_width', '>= 1.4.0', '< 3.0')

Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cli_spec.rb
Expand Up @@ -1692,7 +1692,7 @@ def method(foo, bar, qux, fred, arg5, f) end #{'#' * 85}
expect($stderr.string.strip).to start_with(
'Error: RuboCop found unknown Ruby version 4.0 in `TargetRubyVersion`'
)
expect($stderr.string.strip).to match(/Supported versions: 2.5, 2.6, 2.7, 3.0, 3.1/)
expect($stderr.string.strip).to match(/Supported versions: 2.5, 2.6, 2.7, 3.0, 3.1, 3.2/)
end
end

Expand Down

0 comments on commit de67909

Please sign in to comment.