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

Remove ruby 2.7 support #1406

Merged
merged 1 commit into from
Nov 27, 2023
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
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ruby-2.7, ruby-3.0, ruby-3.1.2, ruby-3.1, ruby-3.2]
ruby: [ruby-3.0, ruby-3.1.2, ruby-3.1, ruby-3.2]
os: [ubuntu-latest]
include:
- os: macos-latest
Expand All @@ -40,7 +40,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ruby-2.7, ruby-3.0, ruby-3.1.2, ruby-3.1, ruby-3.2]
ruby: [ruby-3.0, ruby-3.1.2, ruby-3.1, ruby-3.2]
os: [ubuntu-latest]
include:
- os: macos-latest
Expand All @@ -65,7 +65,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ruby-2.7, ruby-3.0, ruby-3.1.2, ruby-3.1, ruby-3.2]
ruby: [ruby-3.0, ruby-3.1.2, ruby-3.1, ruby-3.2]
os: [ubuntu-latest]
include:
- os: macos-latest
Expand All @@ -92,7 +92,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ruby-2.7, ruby-3.0, ruby-3.1.2, ruby-3.1, ruby-3.2]
ruby: [ruby-3.0, ruby-3.1.2, ruby-3.1, ruby-3.2]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
Expand All @@ -108,7 +108,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ruby-2.7, ruby-3.0, ruby-3.1.2, ruby-3.1, ruby-3.2]
ruby: [ruby-3.0, ruby-3.1.2, ruby-3.1, ruby-3.2]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
Expand All @@ -124,7 +124,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ruby-2.7, ruby-3.0, ruby-3.1.2, ruby-3.1, ruby-3.2]
ruby: [ruby-3.0, ruby-3.1.2, ruby-3.1, ruby-3.2]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
Expand All @@ -140,7 +140,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ruby-2.7, ruby-3.0, ruby-3.1.2, ruby-3.1, ruby-3.2]
ruby: [ruby-3.0, ruby-3.1.2, ruby-3.1, ruby-3.2]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ AllCops:
- 'tmp/**/*'
- 'vendor/**/*'
NewCops: enable
TargetRubyVersion: 2.7
TargetRubyVersion: 3.0
# This is output on every run of `rubocop` and feels fairly noisy.
SuggestExtensions: false

Expand Down
6 changes: 5 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v0.11.26 unreleased

* Drop support for ruby 2.7

# v0.11.25 2023-10-18

* Add support for commercial organization wide licenses
Expand Down Expand Up @@ -37,7 +41,7 @@

The old key is still supported but deprecated.

Add ability to provide multiple `--integration-argument` options that get passed down
Add ability to provide multiple `--integration-argument` options that get passed down
directly to rspec. Also available in the config file.

# v0.11.20 2023-05-22
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,12 @@ Supported indicates if a specific Ruby version / Implementation is actively supp

| Implementation | Version | Runtime | Syntax | Mutations | Supported |
| -------------- | -------------- | ------- | ------------------ | ------------------ | ------------------ |
| cRUBY/MRI | 2.7 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| cRUBY/MRI | 3.0 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| cRUBY/MRI | 3.1 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| cRUBY/MRI | 3.2 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| jruby | TBD | :email: | :email: | :email: | :email: |
| mruby | TBD | :email: | :email: | :email: | :email: |
| cRUBY/MRI | < 2.7 | :no_entry: | :no_entry: | :no_entry: | :no_entry: |
| cRUBY/MRI | < 3.0 | :no_entry: | :no_entry: | :no_entry: | :no_entry: |


Labels:
Expand Down
4 changes: 2 additions & 2 deletions lib/mutant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ module Mutant

env_key = /[a-zA-Z_\d]+/

ENV_VARIABLE_KEY_VALUE_REGEXP = /\A(?<key>#{env_key}+)=(?<value>.*)\z/.freeze
ENV_VARIABLE_KEY_REGEXP = /\A#{env_key}\z/.freeze
ENV_VARIABLE_KEY_VALUE_REGEXP = /\A(?<key>#{env_key}+)=(?<value>.*)\z/
ENV_VARIABLE_KEY_REGEXP = /\A#{env_key}\z/

# rubocop:disable Metrics/BlockLength
record.call(:require_mutant_lib) do
Expand Down
2 changes: 1 addition & 1 deletion lib/mutant/ast/pattern/lexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Pattern
# rubocop:disable Metrics/ClassLength
class Lexer
WHITESPACE = [' ', "\t", "\n"].to_set.freeze
STRING_PATTERN = /\A[a-zA-Z][_a-zA-Z0-9]*\z/.freeze
STRING_PATTERN = /\A[a-zA-Z][_a-zA-Z0-9]*\z/

SINGLE_CHAR =
{
Expand Down
4 changes: 2 additions & 2 deletions lib/mutant/expression.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ module Mutant

# Abstract base class for match expression
class Expression
fragment = /[A-Za-z][A-Za-z\d_]*/.freeze
SCOPE_NAME_PATTERN = /(?<scope_name>#{fragment}(?:#{SCOPE_OPERATOR}#{fragment})*)/.freeze
fragment = /[A-Za-z][A-Za-z\d_]*/
SCOPE_NAME_PATTERN = /(?<scope_name>#{fragment}(?:#{SCOPE_OPERATOR}#{fragment})*)/
SCOPE_SYMBOL_PATTERN = '(?<scope_symbol>[.#])'

private_constant(*constants(false))
Expand Down
2 changes: 1 addition & 1 deletion lib/mutant/expression/descendants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Expression
class Descendants < self
include Anima.new(:const_name)

REGEXP = /\Adescendants:(?<const_name>.+)\z/.freeze
REGEXP = /\Adescendants:(?<const_name>.+)\z/

def syntax
"descendants:#{const_name}"
Expand Down
4 changes: 2 additions & 2 deletions lib/mutant/expression/method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ class Method < self
'#' => [Matcher::Methods::Instance].freeze
}.freeze

METHOD_NAME_PATTERN = /(?<method_name>.+)/.freeze
METHOD_NAME_PATTERN = /(?<method_name>.+)/

private_constant(*constants(false))

REGEXP = /\A#{SCOPE_NAME_PATTERN}#{SCOPE_SYMBOL_PATTERN}#{METHOD_NAME_PATTERN}\z/.freeze
REGEXP = /\A#{SCOPE_NAME_PATTERN}#{SCOPE_SYMBOL_PATTERN}#{METHOD_NAME_PATTERN}\z/

def initialize(*)
super
Expand Down
2 changes: 1 addition & 1 deletion lib/mutant/expression/methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Methods < self

private_constant(*constants(false))

REGEXP = /\A#{SCOPE_NAME_PATTERN}#{SCOPE_SYMBOL_PATTERN}\z/.freeze
REGEXP = /\A#{SCOPE_NAME_PATTERN}#{SCOPE_SYMBOL_PATTERN}\z/

def initialize(*)
super
Expand Down
6 changes: 3 additions & 3 deletions lib/mutant/expression/namespace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ class Namespace < self

# Recursive namespace expression
class Recursive < self
REGEXP = /\A#{SCOPE_NAME_PATTERN}?\*\z/.freeze
REGEXP = /\A#{SCOPE_NAME_PATTERN}?\*\z/

# Initialize object
#
# @return [undefined]
def initialize(*)
super

@syntax = "#{scope_name}*".freeze # rubocop:disable Style/RedundantFreeze
@syntax = "#{scope_name}*".freeze

@recursion_pattern = Regexp.union(
/\A#{scope_name}\z/,
Expand Down Expand Up @@ -60,7 +60,7 @@ class Exact < self
MATCHER = Matcher::Scope
private_constant(*constants(false))

REGEXP = /\A#{SCOPE_NAME_PATTERN}\z/.freeze
REGEXP = /\A#{SCOPE_NAME_PATTERN}\z/

# Matcher matcher on expression
#
Expand Down
2 changes: 1 addition & 1 deletion lib/mutant/integration/rspec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Integration
class Rspec < self

ALL_EXPRESSION = Expression::Namespace::Recursive.new(scope_name: nil)
EXPRESSION_CANDIDATE = /\A([^ ]+)(?: )?/.freeze
EXPRESSION_CANDIDATE = /\A([^ ]+)(?: )?/
EXIT_SUCCESS = 0
DEFAULT_CLI_OPTIONS = %w[--fail-fast spec].freeze
TEST_ID_FORMAT = 'rspec:%<index>d:%<location>s/%<description>s'
Expand Down
8 changes: 4 additions & 4 deletions lib/mutant/license/subscription/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ class Subscription
class Repository
include Anima.new(:host, :path)

REMOTE_REGEXP = /\A[^\t]+\t(?<url>[^ ]+) \((?:fetch|push)\)\n\z/.freeze
GIT_SSH_REGEXP = %r{\A[^@]+@(?<host>[^:/]+)[:/](?<path>.+?)(?:\.git)?\z}.freeze
GIT_HTTPS_REGEXP = %r{\Ahttps://(?<host>[^/]+)/(?<path>.+?)(?:\.git)?\z}.freeze
REMOTE_REGEXP = /\A[^\t]+\t(?<url>[^ ]+) \((?:fetch|push)\)\n\z/
GIT_SSH_REGEXP = %r{\A[^@]+@(?<host>[^:/]+)[:/](?<path>.+?)(?:\.git)?\z}
GIT_HTTPS_REGEXP = %r{\Ahttps://(?<host>[^/]+)/(?<path>.+?)(?:\.git)?\z}
WILDCARD = '/*'
WILDCARD_RANGE = (..-WILDCARD.length).freeze
WILDCARD_RANGE = (..-WILDCARD.length)

private_constant(*constants(false))

Expand Down
2 changes: 1 addition & 1 deletion lib/mutant/loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Loader
include Anima.new(:binding, :kernel, :source, :subject)

FROZEN_STRING_FORMAT = "# frozen_string_literal: true\n%s"
VOID_VALUE_REGEXP = /\A[^:]+:\d+: void value expression/.freeze
VOID_VALUE_REGEXP = /\A[^:]+:\d+: void value expression/

private_constant(*constants(false))

Expand Down
2 changes: 1 addition & 1 deletion lib/mutant/matcher/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Config
:diffs
)

INSPECT_FORMAT = "#<#{self} %s>"
INSPECT_FORMAT = "#<#{self} %s>".freeze
ATTRIBUTE_DELIMITER = ' '
ATTRIBUTE_FORMAT = '%s: [%s]'
ENUM_DELIMITER = ','
Expand Down
2 changes: 1 addition & 1 deletion lib/mutant/mutation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Mutation
include Anima.new(:subject, :node)

CODE_DELIMITER = "\0"
CODE_RANGE = (..4).freeze
CODE_RANGE = (..4)

# Mutation identification code
#
Expand Down
4 changes: 2 additions & 2 deletions lib/mutant/mutator/node/index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Mutator
class Node
# Base mutator for index operations
class Index < self
NO_VALUE_RANGE = (1..-1).freeze
NO_VALUE_RANGE = (1..-1)
SEND_REPLACEMENTS = %i[at fetch key?].freeze

private_constant(*constants(false))
Expand Down Expand Up @@ -67,7 +67,7 @@ def index_range

# Mutator for index assignments
class Assign < self
REGULAR_RANGE = (1..-2).freeze
REGULAR_RANGE = (1..-2)

private_constant(*constants(false))

Expand Down
2 changes: 1 addition & 1 deletion lib/mutant/mutator/node/named_value/access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def dispatch

# Named value access emitter for instance variables
class Ivar < Access
NAME_RANGE = (1..-1).freeze
NAME_RANGE = (1..-1)

handle(:ivar)

Expand Down
2 changes: 1 addition & 1 deletion lib/mutant/mutator/node/rescue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Rescue < self

define_named_child(:else_body, -1)

RESCUE_INDICES = (1..-2).freeze
RESCUE_INDICES = (1..-2)

private

Expand Down
2 changes: 1 addition & 1 deletion lib/mutant/mutator/node/send/attribute_assignment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Send
# Mutator for attribute assignments
class AttributeAssignment < self

ATTRIBUTE_RANGE = (..-2).freeze
ATTRIBUTE_RANGE = (..-2)

private_constant(*constants(false))

Expand Down
6 changes: 3 additions & 3 deletions lib/mutant/repository/diff.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Repository
class Diff
include Adamantium, Anima.new(:world, :to)

FORMAT = /\A:\d{6} \d{6} [a-f\d]{40} [a-f\d]{40} [ACDMRTUX]\t(.*)\n\z/.freeze
FORMAT = /\A:\d{6} \d{6} [a-f\d]{40} [a-f\d]{40} [ACDMRTUX]\t(.*)\n\z/

private_constant(*constants(false))

Expand Down Expand Up @@ -85,8 +85,8 @@ def parse_line(root, line)
class Path
include Adamantium, Anima.new(:world, :to, :path)

DECIMAL = /(?:0|[1-9]\d*)/.freeze
REGEXP = /\A@@ -(#{DECIMAL})(?:,(#{DECIMAL}))? \+(#{DECIMAL})(?:,(#{DECIMAL}))? @@/.freeze
DECIMAL = /(?:0|[1-9]\d*)/
REGEXP = /\A@@ -(#{DECIMAL})(?:,(#{DECIMAL}))? \+(#{DECIMAL})(?:,(#{DECIMAL}))? @@/

private_constant(*constants(false))

Expand Down
4 changes: 2 additions & 2 deletions lib/mutant/repository/diff/ranges.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ module Mutant
module Repository
class Diff
module Ranges
DECIMAL = /(?:0|[1-9]\d*)/.freeze
REGEXP = /\A@@ -(#{DECIMAL})(?:,(#{DECIMAL}))? \+(#{DECIMAL})(?:,(#{DECIMAL}))? @@/.freeze
DECIMAL = /(?:0|[1-9]\d*)/
REGEXP = /\A@@ -(#{DECIMAL})(?:,(#{DECIMAL}))? \+(#{DECIMAL})(?:,(#{DECIMAL}))? @@/

private_constant(*constants(false))

Expand Down
4 changes: 2 additions & 2 deletions lib/mutant/subject/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ class Config

DEFAULT = new(inline_disable: false, mutation: Mutation::Config::DEFAULT)

DISABLE_REGEXP = /(\s|^)mutant:disable(?:\s|$)/.freeze
SYNTAX_REGEXP = /\A(?:#|=begin\n)/.freeze
DISABLE_REGEXP = /(\s|^)mutant:disable(?:\s|$)/
SYNTAX_REGEXP = /\A(?:#|=begin\n)/

def self.parse(comments:, mutation:)
new(
Expand Down
2 changes: 1 addition & 1 deletion mutant-minitest.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Gem::Specification.new do |gem|

gem.extra_rdoc_files = %w[LICENSE]

gem.required_ruby_version = '>= 2.7'
gem.required_ruby_version = '>= 3.0'

gem.metadata['rubygems_mfa_required'] = 'true'

Expand Down
2 changes: 1 addition & 1 deletion mutant-rspec.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Gem::Specification.new do |gem|

gem.metadata['rubygems_mfa_required'] = 'true'

gem.required_ruby_version = '>= 2.7'
gem.required_ruby_version = '>= 3.0'

gem.add_runtime_dependency('mutant', "= #{gem.version}")
gem.add_runtime_dependency('rspec-core', '>= 3.8.0', '< 4.0.0')
Expand Down
2 changes: 1 addition & 1 deletion mutant.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Gem::Specification.new do |gem|

gem.metadata['rubygems_mfa_required'] = 'true'

gem.required_ruby_version = '>= 2.7'
gem.required_ruby_version = '>= 3.0'

gem.add_runtime_dependency('diff-lcs', '~> 1.3')
gem.add_runtime_dependency('parser', '~> 3.2.2', '>= 3.2.2.4')
Expand Down
3 changes: 0 additions & 3 deletions spec/integrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@
mutation_coverage: false
mutation_generation: true
exclude:
# invalid regexp on <2.7 parser
- test/corpus/literal/pattern.rb
- test/corpus/literal/since/27.rb
# invalid regexp on <3.0 parser
- test/corpus/literal/since/30.rb
# invalid regexp on <3.1 parser
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/mutant/expression/parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ def apply
let(:test_a) do
Class.new(Mutant::Expression) do
include Unparser::Anima.new
const_set(:REGEXP, /\Atest-syntax\z/.freeze)
const_set(:REGEXP, /\Atest-syntax\z/)
end
end

let(:test_b) do
Class.new(Mutant::Expression) do
include Unparser::Anima.new
const_set(:REGEXP, /^test-syntax$/.freeze)
const_set(:REGEXP, /^test-syntax$/)
end
end

Expand Down