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

Drop Ruby 2.5 support #232

Merged
merged 1 commit into from
Apr 26, 2022
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
6 changes: 3 additions & 3 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu ]
ruby: [ 2.5, 2.6, 2.7, '3.0', 3.1, head ]
ruby: [ 2.6, 2.7, '3.0', 3.1, head ]
coverage: [ null ]
modern: [ null ]
title: [ null ]
include:
- { os: windows, ruby: mingw }
- { ruby: 2.5, os: ubuntu, coverage: true, title: 'Coverage' }
- { ruby: 2.6, os: ubuntu, coverage: true, title: 'Coverage' }
- { ruby: '3.0', os: ubuntu, modern: true, title: 'Specs "modern"' }
# jruby disabled because of: https://github.com/jruby/jruby/issues/6416
# - { ruby: jruby, os: ubuntu }
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu ]
ruby: [ 2.5, 2.7 ]
ruby: [ 2.6, 2.7 ]
rubocop: [ master ]
internal_investigation: [ null ]
include:
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ AllCops:
- 'lib/rubocop/ast/node_pattern/lexer.rex.rb'
- 'spec/rubocop/ast/node_pattern/parse_helper.rb'
- 'spec/rubocop/ast/fixtures/*'
TargetRubyVersion: 2.5
TargetRubyVersion: 2.6
SuggestExtensions: false

InternalAffairs/NodeMatcherDirective:
Expand Down
1 change: 1 addition & 0 deletions changelog/change_drop_ruby_25.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [#232](https://github.com/rubocop/rubocop-ast/pull/232): **(Breaking)** Drop support for Ruby 2.5. ([@koic][])
2 changes: 1 addition & 1 deletion lib/rubocop/ast/node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def left_siblings
def right_siblings
return [].freeze unless parent

parent.children[sibling_index + 1..-1].freeze
parent.children[sibling_index + 1..].freeze
end

# Common destructuring method. This can be used to normalize
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/ast/node/mixin/parameterized_node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ module RestArguments
include ParameterizedNode
# @return [Array<Node>] arguments, if any
def arguments
children[first_argument_index..-1].freeze
children[first_argument_index..].freeze
end

# A shorthand for getting the first argument of the node.
Expand Down
4 changes: 2 additions & 2 deletions lib/rubocop/ast/node_pattern/compiler/sequence_subcompiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -371,13 +371,13 @@ def compile_child_nb_guard(arity_range)

# @return [Hash] of {subcompiler => code}
def compile_union_forks
compiler.each_union(node.children).map do |child|
compiler.each_union(node.children).to_h do |child|
subsequence_terms = child.is_a?(Node::Subsequence) ? child.children : [child]
fork = dup
code = fork.compile_terms(subsequence_terms, @remaining_arity)
@in_sync = false if @cur_index != :variadic_mode
[fork, code]
end.to_h # we could avoid map if RUBY_VERSION >= 2.6...
end
end

# Modifies in place `forks` to insure that `cur_{child|index}_var` are ok
Expand Down
6 changes: 3 additions & 3 deletions lib/rubocop/ast/node_pattern/node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class Sequence < Node

def initialize(type, children = [], properties = {})
if (replace = children.first.in_sequence_head)
children = [*replace, *children[1..-1]]
children = [*replace, *children[1..]]
end

super
Expand All @@ -130,7 +130,7 @@ def method_name
end

def arg_list
children[1..-1]
children[1..]
end
end
FunctionCall = Predicate
Expand Down Expand Up @@ -212,7 +212,7 @@ def in_sequence_head

return unless (replace = children.first.in_sequence_head)

[with(children: [*replace, *children[1..-1]])]
[with(children: [*replace, *children[1..]])]
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/ast/traversal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def arity_check(range)
### generic processing of any other node (forward compatibility)
defined = instance_methods(false)
.grep(/^on_/)
.map { |s| s.to_s[3..-1].to_sym } # :on_foo => :foo
.map { |s| s.to_s[3..].to_sym } # :on_foo => :foo

to_define = ::Parser::Meta::NODE_TYPES.to_a
to_define -= defined
Expand Down
2 changes: 1 addition & 1 deletion rubocop-ast.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Gem::Specification.new do |s|
s.name = 'rubocop-ast'
s.version = RuboCop::AST::Version::STRING
s.platform = Gem::Platform::RUBY
s.required_ruby_version = '>= 2.5.0'
s.required_ruby_version = '>= 2.6.0'
s.authors = ['Bozhidar Batsov', 'Jonas Arvidsson', 'Yuji Nakayama']
s.description = <<-DESCRIPTION
RuboCop's Node and NodePattern classes.
Expand Down