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

Support TargetRubyVersion 3.1 (experimental) #9758

Merged
merged 1 commit into from May 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/new_support_ruby_3_1_experimental.md
@@ -0,0 +1 @@
* [#9758](https://github.com/rubocop/rubocop/pull/9758): Support `TargetRubyVersion 3.1` (experimental). ([@koic][])
1 change: 1 addition & 0 deletions docs/modules/ROOT/pages/compatibility.adoc
Expand Up @@ -31,6 +31,7 @@ The following table is the support matrix.
| 2.6 | -
| 2.7 | -
| 3.0 | -
| 3.1 (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 @@ -131,3 +131,7 @@ def source_range(range, buffer: source_buffer)
RSpec.shared_context 'ruby 3.0', :ruby30 do
let(:ruby_version) { 3.0 }
end

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

OBSOLETE_RUBIES = {
Expand Down
2 changes: 1 addition & 1 deletion rubocop.gemspec
Expand Up @@ -35,7 +35,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.2.0', '< 2.0')
s.add_runtime_dependency('rubocop-ast', '>= 1.5.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 @@ -1612,7 +1612,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/)
expect($stderr.string.strip).to match(/Supported versions: 2.5, 2.6, 2.7, 3.0, 3.1/)
end
end

Expand Down