Skip to content

Commit

Permalink
Remove ruby-3.0 support
Browse files Browse the repository at this point in the history
* Ruby 3.0 is EOL
* Removes another remaining invalid super() mutation that would block the upgrade.
  • Loading branch information
mbj committed Jun 10, 2024
1 parent 1ced37f commit 2376b11
Show file tree
Hide file tree
Showing 174 changed files with 702 additions and 717 deletions.
20 changes: 7 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ruby-3.0, ruby-3.1.2, ruby-3.1, ruby-3.2, ruby-3.3]
ruby: [ruby-3.1.2, ruby-3.1, ruby-3.2, ruby-3.3]
os: [ubuntu-latest]
include:
- os: macos-latest
ruby: ruby-3.2
- os: macos-latest
ruby: ruby-3.1
- os: macos-latest
ruby: ruby-3.0
execution:
- bundle exec rspec spec/unit
- bundle exec mutant environment test run spec/unit
Expand All @@ -43,15 +41,13 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ruby-3.0, ruby-3.1.2, ruby-3.1, ruby-3.2, ruby-3.3]
ruby: [ruby-3.1.2, ruby-3.1, ruby-3.2, ruby-3.3]
os: [ubuntu-latest]
include:
- os: macos-latest
ruby: ruby-3.2
- os: macos-latest
ruby: ruby-3.1
- os: macos-latest
ruby: ruby-3.0
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -68,15 +64,13 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ruby-3.0, ruby-3.1.2, ruby-3.1, ruby-3.2, ruby-3.3]
ruby: [ruby-3.1.2, ruby-3.1, ruby-3.2, ruby-3.3]
os: [ubuntu-latest]
include:
- os: macos-latest
ruby: ruby-3.2
- os: macos-latest
ruby: ruby-3.1
- os: macos-latest
ruby: ruby-3.0
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
Expand All @@ -96,7 +90,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ruby-3.0, ruby-3.1.2, ruby-3.1, ruby-3.2, ruby-3.3]
ruby: [ruby-3.1.2, ruby-3.1, ruby-3.2, ruby-3.3]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
Expand All @@ -112,7 +106,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ruby-3.0, ruby-3.1.2, ruby-3.1, ruby-3.2, ruby-3.3]
ruby: [ruby-3.1.2, ruby-3.1, ruby-3.2, ruby-3.3]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
Expand All @@ -128,7 +122,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ruby-3.0, ruby-3.1.2, ruby-3.1, ruby-3.2, ruby-3.3]
ruby: [ruby-3.1.2, ruby-3.1, ruby-3.2, ruby-3.3]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
Expand All @@ -144,7 +138,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ruby-3.0, ruby-3.1.2, ruby-3.1, ruby-3.2, ruby-3.3]
ruby: [ruby-3.1.2, ruby-3.1, ruby-3.2, ruby-3.3]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
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: 3.0
TargetRubyVersion: 3.1
# This is output on every run of `rubocop` and feels fairly noisy.
SuggestExtensions: false

Expand Down
8 changes: 7 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# v0.12.3 2024-06-10

* [#1452](https://github.com/mbj/mutant/pull/1451)

Remove another invalid mutation to super().

# v0.12.2 2024-06-09

+ [#1450](https://github.com/mbj/mutant/pull/1450)
* [#1450](https://github.com/mbj/mutant/pull/1450)

Remove invalid mutation operator.

Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
mutant (0.12.2)
mutant (0.12.3)
diff-lcs (~> 1.3)
parser (~> 3.3.0)
regexp_parser (~> 2.9.0)
Expand Down
16 changes: 8 additions & 8 deletions lib/mutant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -291,22 +291,22 @@ module Mutant
boot_segments = boot_events.map do |name, timestamp_start, timestamp_end|
Segment.new(
id: gen_id.call,
name: name,
name:,
parent_id: library_segment.id,
timestamp_end: timestamp_end,
timestamp_start: timestamp_start
timestamp_end:,
timestamp_start:
)
end

timer = Timer.new(process: Process)

recorder = Segment::Recorder.new(
gen_id: gen_id,
gen_id:,
root_id: (executable_segment || library_segment).id,
parent_id: library_segment.id,
recording_start: recording_start,
recording_start:,
segments: [*executable_segment, library_segment, *boot_segments],
timer: timer
timer:
)

WORLD = World.new(
Expand All @@ -325,13 +325,13 @@ module Mutant
pathname: Pathname,
process: Process,
random: Random,
recorder: recorder,
recorder:,
stderr: $stderr,
stdout: $stdout,
tempfile: Tempfile,
thread: Thread,
time: Time,
timer: timer
timer:
)

# Reopen class to initialize constant to avoid dep circle
Expand Down
2 changes: 1 addition & 1 deletion lib/mutant/ast.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class View

def on_line(line)
line_map.fetch(line, EMPTY_HASH).map do |node, stack|
View.new(node: node, stack: stack)
View.new(node:, stack:)
end
end

Expand Down
4 changes: 2 additions & 2 deletions lib/mutant/ast/named_children.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ def children(*names)
# @param [Symbol] name
#
# @return [undefined]
def define_private_method(name, &block)
define_method(name, &block)
def define_private_method(name, &)
define_method(name, &)
private(name)
end

Expand Down
12 changes: 6 additions & 6 deletions lib/mutant/ast/pattern/lexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def initialize(string)
@line_index = 0
@line_start = 0
@next_position = 0
@source = Source.new(string: string)
@source = Source.new(string:)
@string = string
@tokens = []
end
Expand Down Expand Up @@ -77,13 +77,13 @@ def consume_char

advance_position

@tokens << token(type: type, start_position: start_position)
@tokens << token(type:, start_position:)
end

def token(type:, start_position:, value: nil)
Token.new(
type: type,
value: value,
type:,
value:,
location: Source::Location.new(
source: @source,
line_index: @line_index,
Expand All @@ -101,7 +101,7 @@ def consume_string
if valid_string?(token.value)
@tokens << token
else
@error = Error::InvalidToken.new(token: token)
@error = Error::InvalidToken.new(token:)
end
end

Expand All @@ -123,7 +123,7 @@ def build_string(start_position, string)
token(
type: :string,
value: string,
start_position: start_position
start_position:
)
end

Expand Down
18 changes: 9 additions & 9 deletions lib/mutant/ast/pattern/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def run
token = peek
error(
message: "Unexpected token: #{token.type}",
token: token
token:
)
end
end
Expand Down Expand Up @@ -74,15 +74,15 @@ def parse_node
end

Node.new(
attribute: attribute,
descendant: descendant,
attribute:,
descendant:,
type: structure.type
)
end

def parse_attribute(name)
Node::Attribute.new(
name: name,
name:,
value: parse_alternative(
group_start: method(:parse_attribute_group),
string: method(:parse_attribute_value)
Expand All @@ -96,14 +96,14 @@ def parse_alternative(alternatives)
alternatives.fetch(token.type) do
error(
message: "Expected one of: #{alternatives.keys.join(',')} but got: #{token.type}",
token: token
token:
)
end.call
end

def parse_descendant(name)
Node::Descendant.new(
name: name,
name:,
pattern: parse_node
)
end
Expand All @@ -120,7 +120,7 @@ def parse_attribute_group

expect(:group_end)

Node::Attribute::Value::Group.new(values: values)
Node::Attribute::Value::Group.new(values:)
end

def parse_attribute_value
Expand Down Expand Up @@ -153,7 +153,7 @@ def parse_node_type
type = token.value.to_sym

Structure::ALL.fetch(type) do
error(token: token, message: "Expected valid node type got: #{type}")
error(token:, message: "Expected valid node type got: #{type}")
end
end

Expand All @@ -169,7 +169,7 @@ def expect(type)
token
else
error(
token: token,
token:,
message: "Expected token type: #{type} but got: #{token.type}"
)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/mutant/ast/structure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def maybe_descendant(name)

def self.fixed(values)
values.each_with_index.map do |(klass, name), index|
klass.new(index: index, name: name)
klass.new(index:, name:)
end
end

Expand Down
24 changes: 12 additions & 12 deletions lib/mutant/bootstrap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def self.call(env)
.with(matchable_scopes: matchable_scopes(env))

matched_subjects = env.record(:subject_match) do
Matcher.expand(env: env).call(env)
Matcher.expand(env:).call(env)
end

selected_subjects = subject_select(env, matched_subjects)
Expand All @@ -48,9 +48,9 @@ def self.call(env)
end

setup_integration(
env: env,
mutations: mutations,
selected_subjects: selected_subjects
env:,
mutations:,
selected_subjects:
)
end
end
Expand Down Expand Up @@ -79,9 +79,9 @@ def self.setup_integration(env:, mutations:, selected_subjects:)
hooks.run(:setup_integration_pre)
Integration.setup(env).fmap do |integration|
env.with(
integration: integration,
mutations: mutations,
selector: Selector::Expression.new(integration: integration),
integration:,
mutations:,
selector: Selector::Expression.new(integration:),
subjects: selected_subjects
)
end.tap { hooks.run(:setup_integration_post) }
Expand Down Expand Up @@ -120,7 +120,7 @@ def self.infect(env)
config, hooks, world = env.config, env.hooks, env.world

env.record(:hooks_env_infection_pre) do
hooks.run(:env_infection_pre, env: env)
hooks.run(:env_infection_pre, env:)
end

env.record(:require_target) do
Expand All @@ -133,7 +133,7 @@ def self.infect(env)
end

env.record(:hooks_env_infection_post) do
hooks.run(:env_infection_post, env: env)
hooks.run(:env_infection_post, env:)
end
end
end
Expand All @@ -147,7 +147,7 @@ def self.matchable_scopes(env)

scopes = env.world.object_space.each_object(Module).with_object([]) do |raw_scope, aggregate|
expression = expression(config.reporter, config.expression_parser, raw_scope) || next
aggregate << Scope.new(raw: raw_scope, expression: expression)
aggregate << Scope.new(raw: raw_scope, expression:)
end

scopes.sort_by { |scope| scope.expression.syntax }
Expand Down Expand Up @@ -177,9 +177,9 @@ def self.expression(reporter, expression_parser, raw_scope)
semantics_warning(
reporter,
CLASS_NAME_TYPE_MISMATCH_FORMAT,
name: name,
name:,
scope_class: raw_scope.class,
raw_scope: raw_scope
raw_scope:
)
return
end
Expand Down
2 changes: 1 addition & 1 deletion lib/mutant/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module CLI
#
# @return [Command]
def self.parse(arguments:, world:)
Command::Root.parse(arguments: arguments, world: world)
Command::Root.parse(arguments:, world:)
end
end # CLI
end # Mutant
Loading

0 comments on commit 2376b11

Please sign in to comment.