diff --git a/CHANGELOG.md b/CHANGELOG.md index e0debfe3ed8..e8d4c8dee32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### New features * [#7868](https://github.com/rubocop-hq/rubocop/pull/7868): `Cop::Base` is the new recommended base class for cops. ([@marcandre][]) +* [#8213](https://github.com/rubocop-hq/rubocop/pull/8213): Permit to specify TargetRubyVersion 2.8 (experimental). ([@koic][]) ### Changes diff --git a/docs/modules/ROOT/pages/compatibility.adoc b/docs/modules/ROOT/pages/compatibility.adoc index 54dde00e664..4aeb7c66af1 100644 --- a/docs/modules/ROOT/pages/compatibility.adoc +++ b/docs/modules/ROOT/pages/compatibility.adoc @@ -30,6 +30,7 @@ The following table is the support matrix. | 2.5 | - | 2.6 | - | 2.7 | - +| 2.8 (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). diff --git a/lib/rubocop/target_ruby.rb b/lib/rubocop/target_ruby.rb index 670ea2d244c..75f12beaefe 100644 --- a/lib/rubocop/target_ruby.rb +++ b/lib/rubocop/target_ruby.rb @@ -3,7 +3,7 @@ module RuboCop # The kind of Ruby that code inspected by RuboCop is written in. class TargetRuby - KNOWN_RUBIES = [2.4, 2.5, 2.6, 2.7].freeze + KNOWN_RUBIES = [2.4, 2.5, 2.6, 2.7, 2.8].freeze DEFAULT_VERSION = KNOWN_RUBIES.first OBSOLETE_RUBIES = { diff --git a/rubocop.gemspec b/rubocop.gemspec index 3fbd0074eab..c997a70af21 100644 --- a/rubocop.gemspec +++ b/rubocop.gemspec @@ -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.7') s.add_runtime_dependency('rexml') - s.add_runtime_dependency('rubocop-ast', '>= 0.0.3', '< 1.0') + s.add_runtime_dependency('rubocop-ast', '>= 0.1.0', '< 1.0') s.add_runtime_dependency('ruby-progressbar', '~> 1.7') s.add_runtime_dependency('unicode-display_width', '>= 1.4.0', '< 2.0') diff --git a/spec/rubocop/cli_spec.rb b/spec/rubocop/cli_spec.rb index d8516d5c04b..4f5918e7837 100644 --- a/spec/rubocop/cli_spec.rb +++ b/spec/rubocop/cli_spec.rb @@ -1632,14 +1632,14 @@ def method(foo, bar, qux, fred, arg5, f) end #{'#' * 85} it 'fails with an error message' do create_file('.rubocop.yml', <<~YAML) AllCops: - TargetRubyVersion: 2.8 + TargetRubyVersion: 3.0 YAML expect(cli.run([])).to eq(2) expect($stderr.string.strip).to start_with( - 'Error: RuboCop found unknown Ruby version 2.8 in `TargetRubyVersion`' + 'Error: RuboCop found unknown Ruby version 3.0 in `TargetRubyVersion`' ) expect($stderr.string.strip).to match( - /Supported versions: 2.4, 2.5, 2.6, 2.7/ + /Supported versions: 2.4, 2.5, 2.6, 2.7, 2.8/ ) end end