Skip to content

Commit

Permalink
Permit to specify TargetRubyVersion 2.8
Browse files Browse the repository at this point in the history
This PR permits to specify TargetRubyVersion 2.8.

RuboCop AST supports Ruby 2.8 (3.0) with
rubocop/rubocop-ast#48.
  • Loading branch information
koic committed Jun 26, 2020
1 parent 8e365cf commit 7e2e32e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions docs/modules/ROOT/pages/compatibility.adoc
Expand Up @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/target_ruby.rb
Expand Up @@ -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 = {
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.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')

Expand Down
6 changes: 3 additions & 3 deletions spec/rubocop/cli_spec.rb
Expand Up @@ -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
Expand Down

0 comments on commit 7e2e32e

Please sign in to comment.