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 Parser::Ruby31 #182

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/new_support_ruby_3_1_parser.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [#182](https://github.com/rubocop-hq/rubocop-ast/pull/182): Support `Parser::Ruby31` for Ruby 3.1 parser (experimental). ([@koic][])
3 changes: 3 additions & 0 deletions lib/rubocop/ast/processed_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ def parser_class(ruby_version)
when 2.8, 3.0
require 'parser/ruby30'
Parser::Ruby30
when 3.1
require 'parser/ruby31'
Parser::Ruby31
else
raise ArgumentError,
"RuboCop found unknown Ruby version: #{ruby_version.inspect}"
Expand Down
2 changes: 1 addition & 1 deletion rubocop-ast.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Gem::Specification.new do |s|
'bug_tracker_uri' => 'https://github.com/rubocop-hq/rubocop-ast/issues'
}

s.add_runtime_dependency('parser', '>= 2.7.1.5')
s.add_runtime_dependency('parser', '>= 3.0.1.1')

s.add_development_dependency('bundler', '>= 1.15.0', '< 3.0')

Expand Down
4 changes: 4 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
let(:ruby_version) { 3.0 }
end

RSpec.shared_context 'ruby 3.1', :ruby31 do
let(:ruby_version) { 3.1 }
end

# ...
module DefaultRubyVersion
extend RSpec::SharedContext
Expand Down