From 0c7c4fdca72887f4acebee470b870311546179f5 Mon Sep 17 00:00:00 2001 From: Markus Schirp Date: Mon, 10 Jun 2024 01:27:17 +0000 Subject: [PATCH] Remove ruby-3.0 support * Ruby 3.0 is EOL * Removes another remaining invalid super() mutation that would block the upgrade. --- .github/workflows/ci.yml | 20 +++----- .rubocop.yml | 2 +- Changelog.md | 8 +++- Gemfile.lock | 2 +- lib/mutant.rb | 16 +++---- lib/mutant/ast.rb | 2 +- lib/mutant/ast/named_children.rb | 4 +- lib/mutant/ast/pattern/lexer.rb | 12 ++--- lib/mutant/ast/pattern/parser.rb | 18 +++---- lib/mutant/ast/structure.rb | 2 +- lib/mutant/bootstrap.rb | 24 +++++----- lib/mutant/cli.rb | 2 +- lib/mutant/cli/command.rb | 16 +++---- lib/mutant/cli/command/environment.rb | 12 ++--- lib/mutant/cli/command/environment/test.rb | 4 +- lib/mutant/cli/command/util.rb | 4 +- lib/mutant/config.rb | 4 +- lib/mutant/env.rb | 20 ++++---- lib/mutant/expression/descendants.rb | 2 +- lib/mutant/expression/method.rb | 4 +- lib/mutant/expression/methods.rb | 4 +- lib/mutant/expression/source.rb | 6 +-- lib/mutant/integration.rb | 4 +- lib/mutant/integration/rspec.rb | 10 ++-- lib/mutant/isolation/fork.rb | 8 ++-- lib/mutant/isolation/none.rb | 4 +- lib/mutant/matcher.rb | 2 +- lib/mutant/matcher/descendants.rb | 2 +- lib/mutant/matcher/method.rb | 10 ++-- lib/mutant/matcher/method/instance.rb | 6 +-- lib/mutant/matcher/method/metaclass.rb | 4 +- lib/mutant/matcher/method/singleton.rb | 2 +- lib/mutant/matcher/methods.rb | 4 +- lib/mutant/matcher/namespace.rb | 2 +- lib/mutant/matcher/scope.rb | 2 +- lib/mutant/meta.rb | 2 +- lib/mutant/meta/example.rb | 8 ++-- lib/mutant/meta/example/verification.rb | 2 +- lib/mutant/mutation.rb | 4 +- lib/mutant/mutation/runner.rb | 2 +- lib/mutant/mutation/runner/sink.rb | 6 +-- lib/mutant/mutator/node.rb | 10 ++-- lib/mutant/mutator/node/block.rb | 2 +- lib/mutant/mutator/node/send.rb | 2 +- lib/mutant/mutator/node/zsuper.rb | 1 - lib/mutant/mutator/regexp.rb | 4 +- lib/mutant/parallel.rb | 6 +-- lib/mutant/parallel/connection.rb | 4 +- lib/mutant/parallel/pipe.rb | 4 +- lib/mutant/parallel/worker.rb | 20 ++++---- lib/mutant/parser.rb | 2 +- lib/mutant/registry.rb | 2 +- lib/mutant/reporter/cli.rb | 6 +-- lib/mutant/reporter/cli/format.rb | 2 +- lib/mutant/reporter/cli/printer.rb | 2 +- .../reporter/cli/printer/isolation_result.rb | 4 +- lib/mutant/repository/diff.rb | 11 +++-- lib/mutant/segment/recorder.rb | 16 +++---- lib/mutant/subject.rb | 2 +- lib/mutant/subject/config.rb | 2 +- lib/mutant/test/runner.rb | 2 +- lib/mutant/test/runner/sink.rb | 2 +- lib/mutant/timer.rb | 2 +- lib/mutant/transform.rb | 40 ++++++++-------- lib/mutant/variable.rb | 4 +- lib/mutant/version.rb | 2 +- lib/mutant/world.rb | 14 +++--- meta/super.rb | 1 - mutant-minitest.gemspec | 2 +- mutant-rspec.gemspec | 2 +- mutant.gemspec | 2 +- spec/integration/mutant/parallel_spec.rb | 24 +++++----- spec/spec_helper.rb | 8 ++-- spec/support/corpus.rb | 6 +-- spec/support/file_system.rb | 2 +- spec/support/ruby_vm.rb | 6 +-- spec/support/shared_context.rb | 20 ++++---- spec/support/xspec.rb | 22 ++++----- .../ast/find_metaclass_containing_spec.rb | 2 +- spec/unit/mutant/ast/meta/optarg_spec.rb | 2 +- .../ast/meta/send/proc_predicate_spec.rb | 2 +- ...possible_top_level_const_predicate_spec.rb | 2 +- spec/unit/mutant/ast/meta/send_spec.rb | 2 +- spec/unit/mutant/ast/named_children_spec.rb | 2 +- spec/unit/mutant/ast/pattern/deep_spec.rb | 2 +- spec/unit/mutant/ast/pattern/node_spec.rb | 10 ++-- .../ast/pattern/source/location_spec.rb | 2 +- spec/unit/mutant/ast/pattern/source_spec.rb | 2 +- spec/unit/mutant/ast_spec.rb | 4 +- spec/unit/mutant/bootstrap_spec.rb | 24 +++++----- spec/unit/mutant/cli_spec.rb | 34 ++++++------- .../mutant/config/coverage_criteria_spec.rb | 6 +-- spec/unit/mutant/config_spec.rb | 6 +-- spec/unit/mutant/context_spec.rb | 6 +-- spec/unit/mutant/env_spec.rb | 44 ++++++++--------- spec/unit/mutant/expression/methods_spec.rb | 6 +-- .../mutant/expression/namespace/exact_spec.rb | 2 +- spec/unit/mutant/expression/source_spec.rb | 10 ++-- spec/unit/mutant/integration/rspec_spec.rb | 12 ++--- spec/unit/mutant/integration_spec.rb | 14 +++--- spec/unit/mutant/isolation/fork_spec.rb | 4 +- spec/unit/mutant/isolation/none_spec.rb | 2 +- spec/unit/mutant/isolation/result_spec.rb | 6 +-- spec/unit/mutant/loader_spec.rb | 6 +-- spec/unit/mutant/matcher/descendants_spec.rb | 4 +- spec/unit/mutant/matcher/filter_spec.rb | 2 +- .../mutant/matcher/method/instance_spec.rb | 16 +++---- .../mutant/matcher/method/metaclass_spec.rb | 4 +- .../mutant/matcher/method/singleton_spec.rb | 6 +-- .../mutant/matcher/methods/instance_spec.rb | 8 ++-- .../mutant/matcher/methods/metaclass_spec.rb | 6 +-- .../mutant/matcher/methods/singleton_spec.rb | 6 +-- spec/unit/mutant/matcher/scope_spec.rb | 8 ++-- spec/unit/mutant/matcher/static_spec.rb | 2 +- spec/unit/mutant/matcher_spec.rb | 6 +-- spec/unit/mutant/meta/example/dsl_spec.rb | 20 ++++---- .../mutant/meta/example/verification_spec.rb | 12 ++--- spec/unit/mutant/meta/example_spec.rb | 10 ++-- spec/unit/mutant/mutation/runner/sink_spec.rb | 10 ++-- spec/unit/mutant/mutation/runner_spec.rb | 18 +++---- spec/unit/mutant/mutation_spec.rb | 10 ++-- spec/unit/mutant/mutator/node_spec.rb | 4 +- .../mutant/parallel/connection/reader_spec.rb | 34 ++++++------- spec/unit/mutant/parallel/connection_spec.rb | 4 +- spec/unit/mutant/parallel/driver_spec.rb | 18 +++---- spec/unit/mutant/parallel/pipe_spec.rb | 4 +- .../unit/mutant/parallel/source/array_spec.rb | 2 +- spec/unit/mutant/parallel/worker_spec.rb | 48 +++++++++---------- spec/unit/mutant/parallel_spec.rb | 38 +++++++-------- spec/unit/mutant/procto_spec.rb | 2 +- .../cli/printer/isolation_result_spec.rb | 10 ++-- .../cli/printer/mutation_result_spec.rb | 2 +- .../cli/printer/test/env_result_spec.rb | 2 +- .../printer/test/status_progressive_spec.rb | 4 +- spec/unit/mutant/reporter/cli/printer_spec.rb | 2 +- spec/unit/mutant/reporter/cli_spec.rb | 16 +++---- spec/unit/mutant/repository/diff_spec.rb | 8 ++-- .../mutant/result/coverage_criteria_spec.rb | 6 +-- spec/unit/mutant/result/env_spec.rb | 10 ++-- spec/unit/mutant/result/mutation_spec.rb | 6 +-- spec/unit/mutant/result/subject_spec.rb | 2 +- spec/unit/mutant/result/test_env_spec.rb | 8 ++-- spec/unit/mutant/segment/recorder_spec.rb | 4 +- spec/unit/mutant/selector/expression_spec.rb | 8 ++-- spec/unit/mutant/subject/config_spec.rb | 2 +- .../mutant/subject/method/instance_spec.rb | 16 +++---- .../mutant/subject/method/metaclass_spec.rb | 8 ++-- .../mutant/subject/method/singleton_spec.rb | 6 +-- spec/unit/mutant/subject_spec.rb | 8 ++-- spec/unit/mutant/test/runner/sink_spec.rb | 22 ++++----- spec/unit/mutant/test/runner_spec.rb | 24 +++++----- spec/unit/mutant/timer/deadline_spec.rb | 6 +-- spec/unit/mutant/timer_spec.rb | 4 +- spec/unit/mutant/transform/array_spec.rb | 10 ++-- spec/unit/mutant/transform/block_spec.rb | 6 +-- spec/unit/mutant/transform/bool_spec.rb | 4 +- spec/unit/mutant/transform/error_spec.rb | 6 +-- spec/unit/mutant/transform/exception_spec.rb | 4 +- spec/unit/mutant/transform/hash_spec.rb | 12 ++--- spec/unit/mutant/transform/index_spec.rb | 12 ++--- spec/unit/mutant/transform/named_spec.rb | 4 +- spec/unit/mutant/transform/primitive_spec.rb | 4 +- spec/unit/mutant/transform/sequence_spec.rb | 8 ++-- spec/unit/mutant/transform/success_spec.rb | 2 +- spec/unit/mutant/variable_spec.rb | 2 +- spec/unit/mutant/world_spec.rb | 16 +++---- spec/unit/mutant/zombifier_spec.rb | 6 +-- test_app/Gemfile.minitest.lock | 12 ++--- test_app/Gemfile.rspec3.10.lock | 10 ++-- test_app/Gemfile.rspec3.11.lock | 10 ++-- test_app/Gemfile.rspec3.12.lock | 10 ++-- test_app/Gemfile.rspec3.13.lock | 10 ++-- test_app/Gemfile.rspec3.8.lock | 12 ++--- test_app/Gemfile.rspec3.9.lock | 10 ++-- 174 files changed, 702 insertions(+), 703 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d5c02416c..20d9c3e17 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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: @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/.rubocop.yml b/.rubocop.yml index 583f77548..282d28f5a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -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 diff --git a/Changelog.md b/Changelog.md index a60b2c870..2ed62edc6 100644 --- a/Changelog.md +++ b/Changelog.md @@ -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. diff --git a/Gemfile.lock b/Gemfile.lock index acac6103b..0099f1f11 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) diff --git a/lib/mutant.rb b/lib/mutant.rb index 2f1d0967f..d08f62eea 100644 --- a/lib/mutant.rb +++ b/lib/mutant.rb @@ -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( @@ -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 diff --git a/lib/mutant/ast.rb b/lib/mutant/ast.rb index 0c3ac7859..9720aa3ea 100644 --- a/lib/mutant/ast.rb +++ b/lib/mutant/ast.rb @@ -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 diff --git a/lib/mutant/ast/named_children.rb b/lib/mutant/ast/named_children.rb index fd555f2c5..e2f6f642a 100644 --- a/lib/mutant/ast/named_children.rb +++ b/lib/mutant/ast/named_children.rb @@ -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 diff --git a/lib/mutant/ast/pattern/lexer.rb b/lib/mutant/ast/pattern/lexer.rb index 855d463bb..3b37e81b7 100644 --- a/lib/mutant/ast/pattern/lexer.rb +++ b/lib/mutant/ast/pattern/lexer.rb @@ -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 @@ -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, @@ -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 @@ -123,7 +123,7 @@ def build_string(start_position, string) token( type: :string, value: string, - start_position: start_position + start_position: ) end diff --git a/lib/mutant/ast/pattern/parser.rb b/lib/mutant/ast/pattern/parser.rb index 18773b259..58523b079 100644 --- a/lib/mutant/ast/pattern/parser.rb +++ b/lib/mutant/ast/pattern/parser.rb @@ -28,7 +28,7 @@ def run token = peek error( message: "Unexpected token: #{token.type}", - token: token + token: ) end end @@ -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) @@ -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 @@ -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 @@ -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 @@ -169,7 +169,7 @@ def expect(type) token else error( - token: token, + token:, message: "Expected token type: #{type} but got: #{token.type}" ) end diff --git a/lib/mutant/ast/structure.rb b/lib/mutant/ast/structure.rb index 5f480a01f..cd8187fa7 100644 --- a/lib/mutant/ast/structure.rb +++ b/lib/mutant/ast/structure.rb @@ -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 diff --git a/lib/mutant/bootstrap.rb b/lib/mutant/bootstrap.rb index d2b058295..52e8af052 100644 --- a/lib/mutant/bootstrap.rb +++ b/lib/mutant/bootstrap.rb @@ -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) @@ -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 @@ -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) } @@ -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 @@ -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 @@ -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 } @@ -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 diff --git a/lib/mutant/cli.rb b/lib/mutant/cli.rb index 4fb333982..15f445cc2 100644 --- a/lib/mutant/cli.rb +++ b/lib/mutant/cli.rb @@ -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 diff --git a/lib/mutant/cli/command.rb b/lib/mutant/cli/command.rb index 70398a423..535c894d5 100644 --- a/lib/mutant/cli/command.rb +++ b/lib/mutant/cli/command.rb @@ -30,10 +30,10 @@ class OptionParser < ::OptionParser def self.parse(arguments:, parent_names: nil, print_profile: false, world:, zombie: false) new( main: nil, - parent_names: parent_names, - print_profile: print_profile, - world: world, - zombie: zombie + parent_names:, + print_profile:, + world:, + zombie: ).__send__(:parse, arguments) end # rubocop:enable Metrics/ParameterLists @@ -184,11 +184,11 @@ def parse_subcommand(arguments) else find_command(command_name).bind do |command| command.parse( - arguments: arguments, + arguments:, parent_names: [*parent_names, self.class::NAME], - print_profile: print_profile, - world: world, - zombie: zombie + print_profile:, + world:, + zombie: ) end end diff --git a/lib/mutant/cli/command/environment.rb b/lib/mutant/cli/command/environment.rb index ff53c8fa4..d6a8a75aa 100644 --- a/lib/mutant/cli/command/environment.rb +++ b/lib/mutant/cli/command/environment.rb @@ -20,7 +20,7 @@ class Environment < self private - def initialize(attributes) + def initialize(_attributes) super @config = Config::DEFAULT.with( coverage_criteria: Config::CoverageCriteria::EMPTY @@ -31,8 +31,8 @@ def bootstrap env = Env.empty(world, @config) env - .record(:config) { Config.load(cli_config: @config, world: world) } - .bind { |config| Bootstrap.call(env.with(config: config)) } + .record(:config) { Config.load(cli_config: @config, world:) } + .bind { |config| Bootstrap.call(env.with(config:)) } end def parse_remaining_arguments(arguments) @@ -99,7 +99,7 @@ def add_integration_argument(value) end def assign_integration_name(name) - set(integration: @config.integration.with(name: name)) + set(integration: @config.integration.with(name:)) end def add_matcher_options(parser) @@ -112,7 +112,7 @@ def add_matcher_options(parser) add_matcher(:start_expressions, @config.expression_parser.call(pattern).from_right) end parser.on('--since REVISION', 'Only select subjects touched since REVISION') do |revision| - add_matcher(:diffs, Repository::Diff.new(to: revision, world: world)) + add_matcher(:diffs, Repository::Diff.new(to: revision, world:)) end end @@ -149,7 +149,7 @@ def add_usage_options(parser) '--usage USAGE_TYPE', Usage, 'License usage: opensource|commercial' - ) { |usage| set(usage: usage) } + ) { |usage| set(usage:) } end end # Run # rubocop:enable Metrics/ClassLength diff --git a/lib/mutant/cli/command/environment/test.rb b/lib/mutant/cli/command/environment/test.rb index 5e3758cd4..8e5759804 100644 --- a/lib/mutant/cli/command/environment/test.rb +++ b/lib/mutant/cli/command/environment/test.rb @@ -19,8 +19,8 @@ def bootstrap env = Env.empty(world, @config) env - .record(:config) { Config.load(cli_config: @config, world: world) } - .bind { |config| Bootstrap.call_test(env.with(config: config)) } + .record(:config) { Config.load(cli_config: @config, world:) } + .bind { |config| Bootstrap.call_test(env.with(config:)) } end class List < self diff --git a/lib/mutant/cli/command/util.rb b/lib/mutant/cli/command/util.rb index d399a0fa5..0c1ed1515 100644 --- a/lib/mutant/cli/command/util.rb +++ b/lib/mutant/cli/command/util.rb @@ -62,7 +62,7 @@ def initialize(_arguments) def add_target_options(parser) parser.on('-e', '--evaluate SOURCE') do |source| - @targets << Target::Source.new(source: source) + @targets << Target::Source.new(source:) end parser.on('-i', '--ignore-pattern AST_PATTERN') do |pattern| @@ -97,7 +97,7 @@ def parse_remaining_arguments(arguments) end def read_file(pathname) - Either::Right.new(Target::File.new(pathname: pathname, source: pathname.read)) + Either::Right.new(Target::File.new(pathname:, source: pathname.read)) rescue StandardError => exception Either::Left.new("Cannot read file: #{exception}") end diff --git a/lib/mutant/config.rb b/lib/mutant/config.rb index 35914d66c..00c84e32c 100644 --- a/lib/mutant/config.rb +++ b/lib/mutant/config.rb @@ -97,7 +97,7 @@ def merge(other) # Load the configuration def self.load(cli_config:, world:) - load_config_file(reporter: cli_config.reporter, world: world).fmap do |file_config| + load_config_file(reporter: cli_config.reporter, world:).fmap do |file_config| DEFAULT.with( jobs: Etc.nprocessors, mutation: Mutation::Config::DEFAULT @@ -117,7 +117,7 @@ def self.load_config_file(reporter:, world:) in [] Either::Right.new(DEFAULT) in [file] - load_contents(reporter: reporter, path: file).fmap(&DEFAULT.public_method(:with)) + load_contents(reporter:, path: file).fmap(&DEFAULT.public_method(:with)) else Either::Left.new(MORE_THAN_ONE_CONFIG_FILE % files.join(', ')) end diff --git a/lib/mutant/env.rb b/lib/mutant/env.rb index add38d847..ad63d9578 100644 --- a/lib/mutant/env.rb +++ b/lib/mutant/env.rb @@ -30,19 +30,19 @@ class Env # rubocop:disable Metrics/MethodLength def self.empty(world, config) new( - config: config, + config:, hooks: Hooks.empty, integration: Integration::Null.new( arguments: EMPTY_ARRAY, expression_parser: config.expression_parser, - world: world + world: ), matchable_scopes: EMPTY_ARRAY, mutations: EMPTY_ARRAY, parser: Parser.new, selector: Selector::Null.new, subjects: EMPTY_ARRAY, - world: world + world: ) end # rubocop:enable Metrics/MethodLength @@ -61,7 +61,7 @@ def cover_index(mutation_index) Result::MutationIndex.new( isolation_result: run_mutation_tests(mutation, tests), - mutation_index: mutation_index, + mutation_index:, runtime: timer.now - start ) end @@ -71,11 +71,11 @@ def run_test_index(test_index) end def emit_mutation_worker_process_start(index:) - hooks.run(:mutation_worker_process_start, index: index) + hooks.run(:mutation_worker_process_start, index:) end def emit_test_worker_process_start(index:) - hooks.run(:test_worker_process_start, index: index) + hooks.run(:test_worker_process_start, index:) end # The test selections @@ -161,17 +161,17 @@ def test_subject_ratio # @param [Symbol] name # # @return [self] - def record(name, &block) - world.record(name, &block) + def record(name, &) + world.record(name, &) end private def run_mutation_tests(mutation, tests) config.isolation.call(config.mutation.timeout) do - hooks.run(:mutation_insert_pre, mutation: mutation) + hooks.run(:mutation_insert_pre, mutation:) result = mutation.insert(world.kernel) - hooks.run(:mutation_insert_post, mutation: mutation) + hooks.run(:mutation_insert_post, mutation:) result.either( ->(_) { Result::Test::VoidValue.instance }, diff --git a/lib/mutant/expression/descendants.rb b/lib/mutant/expression/descendants.rb index cab6716c6..385b92ea7 100644 --- a/lib/mutant/expression/descendants.rb +++ b/lib/mutant/expression/descendants.rb @@ -13,7 +13,7 @@ def syntax # rubocop:disable Lint/UnusedMethodArgument def matcher(env:) - Matcher::Descendants.new(const_name: const_name) + Matcher::Descendants.new(const_name:) end end # Descendants end # Expression diff --git a/lib/mutant/expression/method.rb b/lib/mutant/expression/method.rb index 86968d26f..e817b3202 100644 --- a/lib/mutant/expression/method.rb +++ b/lib/mutant/expression/method.rb @@ -43,7 +43,7 @@ def initialize(*) # rubocop:disable Lint/UnusedMethodArgument def matcher(env:) matcher_candidates = MATCHERS.fetch(scope_symbol) - .map { |submatcher| submatcher.new(scope: scope) } + .map { |submatcher| submatcher.new(scope:) } methods_matcher = Matcher::Chain.new(matchers: matcher_candidates) @@ -82,7 +82,7 @@ def self.valid_method_name?(name) def scope Scope.new( raw: Object.const_get(scope_name), - expression: Namespace::Exact.new(scope_name: scope_name) + expression: Namespace::Exact.new(scope_name:) ) end diff --git a/lib/mutant/expression/methods.rb b/lib/mutant/expression/methods.rb index ec4745f04..f88bd23c2 100644 --- a/lib/mutant/expression/methods.rb +++ b/lib/mutant/expression/methods.rb @@ -38,7 +38,7 @@ def initialize(*) # rubocop:disable Lint/UnusedMethodArgument def matcher(env:) matcher_candidates = MATCHERS.fetch(scope_symbol) - .map { |submatcher| submatcher.new(scope: scope) } + .map { |submatcher| submatcher.new(scope:) } Matcher::Chain.new(matchers: matcher_candidates) end @@ -60,7 +60,7 @@ def match_length(expression) def scope Scope.new( - expression: Namespace::Exact.new(scope_name: scope_name), + expression: Namespace::Exact.new(scope_name:), raw: Object.const_get(scope_name) ) end diff --git a/lib/mutant/expression/source.rb b/lib/mutant/expression/source.rb index d7bcfb670..6573868db 100644 --- a/lib/mutant/expression/source.rb +++ b/lib/mutant/expression/source.rb @@ -12,14 +12,14 @@ def syntax end def matcher(env:) - Matcher::Chain.new(matchers: find_matchers(env: env)) + Matcher::Chain.new(matchers: find_matchers(env:)) end private def find_matchers(env:) - scope_names(env: env).uniq.map do |scope_name| - Namespace::Recursive.new(scope_name: scope_name).matcher(env: nil) + scope_names(env:).uniq.map do |scope_name| + Namespace::Recursive.new(scope_name:).matcher(env: nil) end end diff --git a/lib/mutant/integration.rb b/lib/mutant/integration.rb index 28905b375..391af4ddc 100644 --- a/lib/mutant/integration.rb +++ b/lib/mutant/integration.rb @@ -86,7 +86,7 @@ def self.attempt_require(env) end.lmap do |exception| LOAD_MESSAGE % { exception: exception.inspect, - integration_name: integration_name + integration_name: } end end @@ -101,7 +101,7 @@ def self.attempt_const_get(env) CONST_MESSAGE % { constant_name: "#{self}::#{constant_name}", exception: exception.inspect, - integration_name: integration_name + integration_name: } end end diff --git a/lib/mutant/integration/rspec.rb b/lib/mutant/integration/rspec.rb index 17daeab21..b979bd944 100644 --- a/lib/mutant/integration/rspec.rb +++ b/lib/mutant/integration/rspec.rb @@ -79,7 +79,7 @@ def call(tests) Result::Test.new( job_index: nil, output: '', - passed: passed, + passed:, runtime: timer.now - start ) end @@ -137,14 +137,14 @@ def parse_example(example, index) metadata = example.metadata id = TEST_ID_FORMAT % { - index: index, + index:, location: metadata.fetch(:location), description: metadata.fetch(:full_description) } Test.new( expressions: parse_metadata(metadata), - id: id + id: ) end @@ -172,8 +172,8 @@ def parse_metadata(metadata) end end - def parse_expression(input, &default) - expression_parser.call(input).from_right(&default) + def parse_expression(input, &) + expression_parser.call(input).from_right(&) end def all_examples diff --git a/lib/mutant/isolation/fork.rb b/lib/mutant/isolation/fork.rb index 5d842ce29..6622c4e91 100644 --- a/lib/mutant/isolation/fork.rb +++ b/lib/mutant/isolation/fork.rb @@ -43,7 +43,7 @@ class Pipe # @return [undefined] def self.with(io) io.pipe(binmode: true) do |(reader, writer)| - yield new(reader: reader, writer: writer) + yield new(reader:, writer:) end end @@ -236,11 +236,11 @@ def call(timeout, &block) Pipe.with(io) do |result| Pipe.with(io) do |log| Parent.call( - block: block, - deadline: deadline, + block:, + deadline:, log_pipe: log, result_pipe: result, - world: world + world: ) end end diff --git a/lib/mutant/isolation/none.rb b/lib/mutant/isolation/none.rb index f1d32f053..24d7acc59 100644 --- a/lib/mutant/isolation/none.rb +++ b/lib/mutant/isolation/none.rb @@ -22,11 +22,11 @@ def call(_timeout) end Result.new( - exception: exception, + exception:, log: '', process_status: nil, timeout: nil, - value: value + value: ) end # rubocop:enable Lint/SuppressedException diff --git a/lib/mutant/matcher.rb b/lib/mutant/matcher.rb index 0419d09af..70c9ec680 100644 --- a/lib/mutant/matcher.rb +++ b/lib/mutant/matcher.rb @@ -22,7 +22,7 @@ def self.expand(env:) matcher_config = env.config.matcher Filter.new( - matcher: Chain.new(matchers: matcher_config.subjects.map { |subject| subject.matcher(env: env) }), + matcher: Chain.new(matchers: matcher_config.subjects.map { |subject| subject.matcher(env:) }), predicate: method(:allowed_subject?).curry.call(matcher_config) ) end diff --git a/lib/mutant/matcher/descendants.rb b/lib/mutant/matcher/descendants.rb index 574d95a43..941b61580 100644 --- a/lib/mutant/matcher/descendants.rb +++ b/lib/mutant/matcher/descendants.rb @@ -10,7 +10,7 @@ def call(env) const = env.world.try_const_get(const_name) or return EMPTY_ARRAY Chain.new( - matchers: matched_scopes(env, const).map { |scope| Scope.new(scope: scope) } + matchers: matched_scopes(env, const).map { |scope| Scope.new(scope:) } ).call(env) end diff --git a/lib/mutant/matcher/method.rb b/lib/mutant/matcher/method.rb index 7fc811d18..ed4c642e9 100644 --- a/lib/mutant/matcher/method.rb +++ b/lib/mutant/matcher/method.rb @@ -25,7 +25,7 @@ class Method < self # # @return [Enumerable] def call(env) - evaluator.call(scope: scope, target_method: target_method, env: env) + evaluator.call(scope:, target_method:, env:) end # Abstract method match evaluator @@ -76,9 +76,9 @@ def match_view def subject self.class::SUBJECT_CLASS.new( config: subject_config(matched_view.node), - context: context, + context:, node: matched_view.node, - visibility: visibility + visibility: ) end @@ -87,7 +87,7 @@ def method_name end def context - Context.new(constant_scope: constant_scope, scope: scope, source_path: source_path) + Context.new(constant_scope:, scope:, source_path:) end # rubocop:disable Metrics/MethodLength @@ -101,7 +101,7 @@ def constant_scope if klass klass.new( const: node.children.fetch(0), - descendant: descendant + descendant: ) else descendant diff --git a/lib/mutant/matcher/method/instance.rb b/lib/mutant/matcher/method/instance.rb index 4e2015051..7df4b71de 100644 --- a/lib/mutant/matcher/method/instance.rb +++ b/lib/mutant/matcher/method/instance.rb @@ -23,9 +23,9 @@ def self.new(scope:, target_method:) end super( - evaluator: evaluator, - scope: scope, - target_method: target_method + evaluator:, + scope:, + target_method: ) end # rubocop:enable Metrics/MethodLength diff --git a/lib/mutant/matcher/method/metaclass.rb b/lib/mutant/matcher/method/metaclass.rb index b49549776..cdb91bd09 100644 --- a/lib/mutant/matcher/method/metaclass.rb +++ b/lib/mutant/matcher/method/metaclass.rb @@ -13,7 +13,7 @@ class Metaclass < self # # @return [Matcher::Method::Singleton] def self.new(scope:, target_method:) - super(scope: scope, target_method: target_method, evaluator: Evaluator) + super(scope:, target_method:, evaluator: Evaluator) end # Metaclass method evaluator @@ -40,7 +40,7 @@ def metaclass_receiver?(node) end def metaclass_containing(node) - AST::FindMetaclassContaining.call(ast: ast, target: node) + AST::FindMetaclassContaining.call(ast:, target: node) end def name?(node) diff --git a/lib/mutant/matcher/method/singleton.rb b/lib/mutant/matcher/method/singleton.rb index 821e5afc5..b53be7c3e 100644 --- a/lib/mutant/matcher/method/singleton.rb +++ b/lib/mutant/matcher/method/singleton.rb @@ -10,7 +10,7 @@ class Singleton < self # # @return [Matcher::Method::Singleton] def self.new(scope:, target_method:) - super(scope: scope, target_method: target_method, evaluator: Evaluator) + super(scope:, target_method:, evaluator: Evaluator) end # Singleton method evaluator diff --git a/lib/mutant/matcher/methods.rb b/lib/mutant/matcher/methods.rb index 150bb725b..29f4ab7f7 100644 --- a/lib/mutant/matcher/methods.rb +++ b/lib/mutant/matcher/methods.rb @@ -22,7 +22,7 @@ class Methods < self def call(env) Chain.new( matchers: methods(env).map do |target_method| - matcher.new(scope: scope, target_method: target_method) + matcher.new(scope:, target_method:) end ).call(env) end @@ -110,7 +110,7 @@ def access(env, method_name) candidate_scope.instance_method(method_name) rescue Exception => exception env.warn( - MESSAGE % { scope: scope, method_name: method_name, exception: exception.inspect } + MESSAGE % { scope:, method_name:, exception: exception.inspect } ) nil end diff --git a/lib/mutant/matcher/namespace.rb b/lib/mutant/matcher/namespace.rb index bfcb6a86f..c5dd30f85 100644 --- a/lib/mutant/matcher/namespace.rb +++ b/lib/mutant/matcher/namespace.rb @@ -13,7 +13,7 @@ class Namespace < self # @return [Enumerable] def call(env) Chain.new( - matchers: matched_scopes(env).map { |scope| Scope.new(scope: scope) } + matchers: matched_scopes(env).map { |scope| Scope.new(scope:) } ).call(env) end diff --git a/lib/mutant/matcher/scope.rb b/lib/mutant/matcher/scope.rb index 85c64c1bf..563d0694f 100644 --- a/lib/mutant/matcher/scope.rb +++ b/lib/mutant/matcher/scope.rb @@ -31,7 +31,7 @@ def call(env) private def effective_matchers - MATCHERS.map { |matcher| matcher.new(scope: scope) } + MATCHERS.map { |matcher| matcher.new(scope:) } end end # Scope diff --git a/lib/mutant/meta.rb b/lib/mutant/meta.rb index 327d98a49..e91b5fd92 100644 --- a/lib/mutant/meta.rb +++ b/lib/mutant/meta.rb @@ -18,7 +18,7 @@ class Example # @return [undefined] def self.add(*types, operators: :full, &block) ALL << DSL.call( - block: block, + block:, location: caller_locations(1).first, operators: Mutation::Operators.parse(operators.to_s).from_right, types: Set.new(types) diff --git a/lib/mutant/meta/example.rb b/lib/mutant/meta/example.rb index 836957780..96520f49c 100644 --- a/lib/mutant/meta/example.rb +++ b/lib/mutant/meta/example.rb @@ -40,7 +40,7 @@ def identification def context Context.new( constant_scope: Context::ConstantScope::None.new, - scope: scope, + scope:, source_path: location.path ) end @@ -58,10 +58,10 @@ def original_source_generated # @return [Enumerable] def generated Mutator::Node.mutate( - config: Mutation::Config::DEFAULT.with(operators: operators), - node: node + config: Mutation::Config::DEFAULT.with(operators:), + node: ).map do |node| - Mutation::Evil.new(subject: self, node: node) + Mutation::Evil.new(subject: self, node:) end end memoize :generated diff --git a/lib/mutant/meta/example/verification.rb b/lib/mutant/meta/example/verification.rb index a83ee0a37..56c50f70f 100644 --- a/lib/mutant/meta/example/verification.rb +++ b/lib/mutant/meta/example/verification.rb @@ -94,7 +94,7 @@ def unexpected def missing (example.expected.map(&:node) - mutations.map(&:node)).map do |node| - Mutation::Evil.new(subject: example, node: node) + Mutation::Evil.new(subject: example, node:) end end memoize :missing diff --git a/lib/mutant/mutation.rb b/lib/mutant/mutation.rb index d49788623..0d1400e0b 100644 --- a/lib/mutant/mutation.rb +++ b/lib/mutant/mutation.rb @@ -66,9 +66,9 @@ def insert(kernel) subject.prepare Loader.call( binding: TOPLEVEL_BINDING, - kernel: kernel, + kernel:, source: monkeypatch, - subject: subject + subject: ).fmap do subject.post_insert nil diff --git a/lib/mutant/mutation/runner.rb b/lib/mutant/mutation/runner.rb index fae126f73..f466e2b59 100644 --- a/lib/mutant/mutation/runner.rb +++ b/lib/mutant/mutation/runner.rb @@ -45,7 +45,7 @@ def self.mutation_test_config(env) jobs: env.config.jobs, on_process_start: env.method(:emit_mutation_worker_process_start), process_name: 'mutant-worker-process', - sink: Sink.new(env: env), + sink: Sink.new(env:), source: Parallel::Source::Array.new(jobs: env.mutations.each_index.to_a), timeout: nil, thread_name: 'mutant-worker-thread' diff --git a/lib/mutant/mutation/runner/sink.rb b/lib/mutant/mutation/runner/sink.rb index 1201d6d5b..58f94e498 100644 --- a/lib/mutant/mutation/runner/sink.rb +++ b/lib/mutant/mutation/runner/sink.rb @@ -22,7 +22,7 @@ def initialize(*) # @return [Result::Env] def status Result::Env.new( - env: env, + env:, runtime: env.world.timer.now - @start, subject_results: @subject_results.values ) @@ -48,7 +48,7 @@ def response(response) subject = mutation_result.mutation.subject @subject_results[subject] = Result::Subject.new( - subject: subject, + subject:, coverage_results: previous_coverage_results(subject).dup << coverage_result(mutation_result), tests: env.selections.fetch(subject) ) @@ -60,7 +60,7 @@ def response(response) def coverage_result(mutation_result) Result::Coverage.new( - mutation_result: mutation_result, + mutation_result:, criteria_result: mutation_result.criteria_result(env.config.coverage_criteria) ) end diff --git a/lib/mutant/mutator/node.rb b/lib/mutant/mutator/node.rb index 4b62e3d62..663271cff 100644 --- a/lib/mutant/mutator/node.rb +++ b/lib/mutant/mutator/node.rb @@ -28,9 +28,9 @@ def self.mutate(config:, node:, parent: nil) end self::REGISTRY.lookup(node.type).call( - config: config, + config:, input: node, - parent: parent + parent: ) end @@ -67,7 +67,7 @@ def self.define_named_child(name, index) alias_method :dup_node, :dup_input def mutate(node:, parent: nil) - self.class.mutate(config: config, node: node, parent: parent) + self.class.mutate(config:, node:, parent:) end def mutate_child(index, &block) @@ -131,8 +131,8 @@ def mutate_single_child def run(mutator) mutator.call( - config: config, - input: input, + config:, + input:, parent: nil ).each(&method(:emit)) end diff --git a/lib/mutant/mutator/node/block.rb b/lib/mutant/mutator/node/block.rb index ee35215d1..9e461fc3f 100644 --- a/lib/mutant/mutator/node/block.rb +++ b/lib/mutant/mutator/node/block.rb @@ -56,7 +56,7 @@ def mutate_body_receiver def valid_send_mutation?(node) return false unless n_send?(node) - last = AST::Meta::Send.new(node: node).arguments.last + last = AST::Meta::Send.new(node:).arguments.last !last&.type.equal?(:block_pass) end diff --git a/lib/mutant/mutator/node/send.rb b/lib/mutant/mutator/node/send.rb index 2edbca864..3f7ad5ef8 100644 --- a/lib/mutant/mutator/node/send.rb +++ b/lib/mutant/mutator/node/send.rb @@ -48,7 +48,7 @@ def dispatch end def meta - AST::Meta::Send.new(node: node) + AST::Meta::Send.new(node:) end memoize :meta diff --git a/lib/mutant/mutator/node/zsuper.rb b/lib/mutant/mutator/node/zsuper.rb index e1918af27..13298039d 100644 --- a/lib/mutant/mutator/node/zsuper.rb +++ b/lib/mutant/mutator/node/zsuper.rb @@ -13,7 +13,6 @@ class ZSuper < self def dispatch emit_singletons - emit(N_EMPTY_SUPER) end end # ZSuper diff --git a/lib/mutant/mutator/regexp.rb b/lib/mutant/mutator/regexp.rb index d41820793..d36581e5f 100644 --- a/lib/mutant/mutator/regexp.rb +++ b/lib/mutant/mutator/regexp.rb @@ -59,7 +59,7 @@ def mk_dup def emit_expression(klass:, text:) emit( - klass.construct(text: text).tap do |new| + klass.construct(text:).tap do |new| subexpressions.each do |expression| new << Marshal.load(Marshal.dump(expression)) end @@ -140,7 +140,7 @@ class Replacement < self def dispatch klass, text = MAP.fetch(input.class) - emit(klass.construct(text: text).tap { |new| new.quantifier = input.quantifier }) + emit(klass.construct(text:).tap { |new| new.quantifier = input.quantifier }) end end diff --git a/lib/mutant/parallel.rb b/lib/mutant/parallel.rb index c2ee1af7e..2e5908a6d 100644 --- a/lib/mutant/parallel.rb +++ b/lib/mutant/parallel.rb @@ -17,7 +17,7 @@ def self.async(config:, world:) workers = workers(world, config, shared) Driver.new( - workers: workers, + workers:, threads: threads(world, config, workers), **shared ) @@ -28,11 +28,11 @@ def self.workers(world, config, shared) Array.new(config.jobs) do |index| Worker.start( block: config.block, - index: index, + index:, on_process_start: config.on_process_start, process_name: "#{config.process_name}-#{index}", timeout: config.timeout, - world: world, + world:, **shared ) end diff --git a/lib/mutant/parallel/connection.rb b/lib/mutant/parallel/connection.rb index c4666fba3..23fde5f90 100644 --- a/lib/mutant/parallel/connection.rb +++ b/lib/mutant/parallel/connection.rb @@ -46,7 +46,7 @@ def self.read_response(job:, **attributes) Response.new( error: reader.error, - job: job, + job:, log: reader.log, result: reader.result ) @@ -168,7 +168,7 @@ def send_value(value) def self.from_pipes(marshal:, reader:, writer:) new( - marshal: marshal, + marshal:, reader: Frame.new(io: reader.to_reader), writer: Frame.new(io: writer.to_writer) ) diff --git a/lib/mutant/parallel/pipe.rb b/lib/mutant/parallel/pipe.rb index d4010a158..3ddd6788a 100644 --- a/lib/mutant/parallel/pipe.rb +++ b/lib/mutant/parallel/pipe.rb @@ -10,13 +10,13 @@ class Pipe # @return [undefined] def self.with(io) io.pipe(binmode: true) do |(reader, writer)| - yield new(reader: reader, writer: writer) + yield new(reader:, writer:) end end def self.from_io(io) reader, writer = io.pipe(binmode: true) - new(reader: reader, writer: writer) + new(reader:, writer:) end # Writer end of the pipe diff --git a/lib/mutant/parallel/worker.rb b/lib/mutant/parallel/worker.rb index f03ce90ed..32efd6204 100644 --- a/lib/mutant/parallel/worker.rb +++ b/lib/mutant/parallel/worker.rb @@ -41,20 +41,20 @@ def self.start_config(config) world.stdout.reopen(log_writer) run_child( - config: config, - connection: Connection.from_pipes(marshal: marshal, reader: request, writer: response), - log_writer: log_writer + config:, + connection: Connection.from_pipes(marshal:, reader: request, writer: response), + log_writer: ) end - connection = Connection.from_pipes(marshal: marshal, reader: response, writer: request) + connection = Connection.from_pipes(marshal:, reader: response, writer: request) new( - config: config, - connection: connection, + config:, + connection:, log_reader: log.to_reader, response_reader: connection.reader.io, - pid: pid + pid: ) end private_class_method :start_config @@ -98,10 +98,10 @@ def call response = Connection::Reader.read_response( deadline: config.world.deadline(config.timeout), io: config.world.io, - job: job, - log_reader: log_reader, + job:, + log_reader:, marshal: config.world.marshal, - response_reader: response_reader + response_reader: ) job_done(job) diff --git a/lib/mutant/parser.rb b/lib/mutant/parser.rb index f09a06869..0f2e8b623 100644 --- a/lib/mutant/parser.rb +++ b/lib/mutant/parser.rb @@ -27,7 +27,7 @@ def parse(source) node, comments = Unparser.parse_with_comments(source) AST.new( - node: node, + node:, comment_associations: ::Parser::Source::Comment.associate_by_identity(node, comments) ) end diff --git a/lib/mutant/registry.rb b/lib/mutant/registry.rb index 071de463a..316486ad6 100644 --- a/lib/mutant/registry.rb +++ b/lib/mutant/registry.rb @@ -9,7 +9,7 @@ class Registry # # @return [undefined] def initialize(default) - super(contents: {}, default: default) + super(contents: {}, default:) end # Raised when the type is an invalid type diff --git a/lib/mutant/reporter/cli.rb b/lib/mutant/reporter/cli.rb index aaac84225..d31e8e5b7 100644 --- a/lib/mutant/reporter/cli.rb +++ b/lib/mutant/reporter/cli.rb @@ -15,7 +15,7 @@ def self.build(output) new( format: Format::Progressive.new(tty: output.respond_to?(:tty?) && output.tty?), print_warnings: false, - output: output + output: ) end @@ -80,7 +80,7 @@ def warn(message) # # @return [self] def report(env) - Printer::EnvResult.call(output: output, object: env) + Printer::EnvResult.call(output:, object: env) self end @@ -90,7 +90,7 @@ def report(env) # # @return [self] def test_report(env) - Printer::Test::EnvResult.call(output: output, object: env) + Printer::Test::EnvResult.call(output:, object: env) self end diff --git a/lib/mutant/reporter/cli/format.rb b/lib/mutant/reporter/cli/format.rb index ecdfd8344..7d44e341b 100644 --- a/lib/mutant/reporter/cli/format.rb +++ b/lib/mutant/reporter/cli/format.rb @@ -54,7 +54,7 @@ class Output def format(printer, object) buffer = new_buffer - printer.call(output: Output.new(tty: tty, buffer: buffer), object: object) + printer.call(output: Output.new(tty:, buffer:), object:) buffer.rewind buffer.read end diff --git a/lib/mutant/reporter/cli/printer.rb b/lib/mutant/reporter/cli/printer.rb index e93630b00..6f8bab7d1 100644 --- a/lib/mutant/reporter/cli/printer.rb +++ b/lib/mutant/reporter/cli/printer.rb @@ -61,7 +61,7 @@ def visit_collection(printer, collection) end def visit(printer, object) - printer.call(output: output, object: object) + printer.call(output:, object:) end def info(string, *arguments) diff --git a/lib/mutant/reporter/cli/printer/isolation_result.rb b/lib/mutant/reporter/cli/printer/isolation_result.rb index dd09d93dd..0878344cc 100644 --- a/lib/mutant/reporter/cli/printer/isolation_result.rb +++ b/lib/mutant/reporter/cli/printer/isolation_result.rb @@ -58,7 +58,7 @@ def print_log_messages puts('Log messages (combined stderr and stdout):') log.each_line do |line| - puts('[killfork] %s' % { line: line }) + puts('[killfork] %s' % { line: }) end end @@ -74,7 +74,7 @@ def print_process_status def print_timeout timeout = object.timeout or return - puts(TIMEOUT_ERROR_MESSAGE % { timeout: timeout }) + puts(TIMEOUT_ERROR_MESSAGE % { timeout: }) end def print_exception diff --git a/lib/mutant/repository/diff.rb b/lib/mutant/repository/diff.rb index 4dc68344a..d2a4863b8 100644 --- a/lib/mutant/repository/diff.rb +++ b/lib/mutant/repository/diff.rb @@ -40,8 +40,8 @@ def repository_root .fmap { |status| world.pathname.new(status.stdout.chomp) } end - def touched_path(path, &block) - touched_paths.from_right { |message| fail Error, message }.fetch(path, &block) + def touched_path(path, &) + touched_paths.from_right { |message| fail Error, message }.fetch(path, &) end def touched_paths @@ -62,15 +62,16 @@ def diff_index(root) end # rubocop:disable Metrics/MethodLength + # mutant:disable (3.2 specific mutation) def parse_line(root, line) match = FORMAT.match(line) if match Either::Right.new( Path.new( - path: root.join(match.captures.first), - to: to, - world: world + path: root.join(Util.one(match.captures)), + to:, + world: ) ) else diff --git a/lib/mutant/segment/recorder.rb b/lib/mutant/segment/recorder.rb index ae486f7dd..481ed9f31 100644 --- a/lib/mutant/segment/recorder.rb +++ b/lib/mutant/segment/recorder.rb @@ -23,9 +23,9 @@ def record(name) yield.tap do segments << Segment.new( - id: id, - name: name, - parent_id: parent_id, + id:, + name:, + parent_id:, timestamp_end: timer.now, timestamp_start: start ) @@ -58,7 +58,7 @@ def tree build_node( value: id_index.fetch(root_id), - parent_index: parent_index + parent_index: ) end @@ -69,17 +69,17 @@ def final_segments if segment.timestamp_end segment else - segment.with(timestamp_end: timestamp_end) + segment.with(timestamp_end:) end end end def build_node(value:, parent_index:) Node.new( - value: value, + value:, children: build_children( parent_id: value.id, - parent_index: parent_index + parent_index: ) ) end @@ -87,7 +87,7 @@ def build_node(value:, parent_index:) def build_children(parent_id:, parent_index:) parent_index .fetch(parent_id, EMPTY_ARRAY) - .map { |value| build_node(value: value, parent_index: parent_index) } + .map { |value| build_node(value:, parent_index:) } end def print_node(io, node, indent) diff --git a/lib/mutant/subject.rb b/lib/mutant/subject.rb index 1ddb30587..3870ab60d 100644 --- a/lib/mutant/subject.rb +++ b/lib/mutant/subject.rb @@ -14,7 +14,7 @@ def mutations [neutral_mutation].concat( Mutator::Node.mutate( config: config.mutation, - node: node + node: ).map do |mutant| Mutation::Evil.new(subject: self, node: wrap_node(mutant)) end diff --git a/lib/mutant/subject/config.rb b/lib/mutant/subject/config.rb index 319321f3e..362930682 100644 --- a/lib/mutant/subject/config.rb +++ b/lib/mutant/subject/config.rb @@ -13,7 +13,7 @@ class Config def self.parse(comments:, mutation:) new( inline_disable: comments.any? { |comment| DISABLE_REGEXP.match?(comment_body(comment)) }, - mutation: mutation + mutation: ) end diff --git a/lib/mutant/test/runner.rb b/lib/mutant/test/runner.rb index e00093e5d..f1084107d 100644 --- a/lib/mutant/test/runner.rb +++ b/lib/mutant/test/runner.rb @@ -45,7 +45,7 @@ def self.test_config(env) jobs: env.config.jobs, on_process_start: env.method(:emit_test_worker_process_start), process_name: 'mutant-test-runner-process', - sink: Sink.new(env: env), + sink: Sink.new(env:), source: Parallel::Source::Array.new(jobs: env.integration.all_tests.each_index.to_a), thread_name: 'mutant-test-runner-thread', timeout: nil diff --git a/lib/mutant/test/runner/sink.rb b/lib/mutant/test/runner/sink.rb index 5d4ed4410..9c9852755 100644 --- a/lib/mutant/test/runner/sink.rb +++ b/lib/mutant/test/runner/sink.rb @@ -20,7 +20,7 @@ def initialize(*) # @return [Result::Env] def status Result::TestEnv.new( - env: env, + env:, runtime: env.world.timer.now - @start, test_results: @test_results.sort_by!(&:job_index) ) diff --git a/lib/mutant/timer.rb b/lib/mutant/timer.rb index b30a3d165..a48860bb8 100644 --- a/lib/mutant/timer.rb +++ b/lib/mutant/timer.rb @@ -49,7 +49,7 @@ def ok? # # @return [Status] def status - Status.new(time_left: time_left) + Status.new(time_left:) end # Probe the time left diff --git a/lib/mutant/transform.rb b/lib/mutant/transform.rb index 7ffff916d..fd002cd3c 100644 --- a/lib/mutant/transform.rb +++ b/lib/mutant/transform.rb @@ -35,7 +35,7 @@ class Error # # @return [String] def compact_message - COMPACT % { path: path, message: trace.last.message } + COMPACT % { path:, message: trace.last.message } end memoize :compact_message @@ -77,7 +77,7 @@ class Block < self include Anima.new(:block, :name) def self.capture(name, &block) - new(block: block, name: name) + new(block:, name:) end def call(input) @@ -86,8 +86,8 @@ def call(input) .lmap do |message| Error.new( cause: nil, - input: input, - message: message, + input:, + message:, transform: self ) end @@ -102,9 +102,9 @@ def slug def error(cause: nil, input:, message: nil) Error.new( - cause: cause, - input: input, - message: message, + cause:, + input:, + message:, transform: self ) end @@ -139,10 +139,10 @@ class Index < self # @return [Error] def self.wrap(cause, index) Error.new( - cause: cause, + cause:, input: cause.input, message: nil, - transform: new(index: index, transform: cause.transform) + transform: new(index:, transform: cause.transform) ) end @@ -159,7 +159,7 @@ def call(input) # # @return [Array] def slug - '%d' % { index: index } + '%d' % { index: } end memoize :slug end # Index @@ -183,7 +183,7 @@ def call(input) else failure( error( - input: input, + input:, message: MESSAGE % { actual: input.class, expected: primitive } ) ) @@ -219,7 +219,7 @@ def call(input) failure( error( message: MESSAGE % { actual: input.inspect }, - input: input + input: ) ) end @@ -258,8 +258,8 @@ def run(input) return failure( error( cause: Index.wrap(error, index), - message: MESSAGE % { index: index }, - input: input + message: MESSAGE % { index: }, + input: ) ) end.from_right @@ -310,7 +310,7 @@ def slug # @return [Either] def call(input) transform.call(input).lmap do |error| - error(cause: error, input: input) + error(cause: error, input:) end end end # Key @@ -365,7 +365,7 @@ def transform_keys(keys, input) def coerce_key(key, input) key.call(input.fetch(key.value)).lmap do |error| - error(input: input, cause: error) + error(input:, cause: error) end end @@ -380,8 +380,8 @@ def reject_keys(input) else failure( error( - input: input, - message: KEY_MESSAGE % { missing: missing, unexpected: unexpected } + input:, + message: KEY_MESSAGE % { missing:, unexpected: } ) ) end @@ -413,7 +413,7 @@ def call(input) steps.each_with_index do |step, index| current = step.call(current).from_right do |error| - return failure(error(cause: Index.wrap(error, index), input: input)) + return failure(error(cause: Index.wrap(error, index), input:)) end end @@ -447,7 +447,7 @@ class Exception < self def call(input) Either .wrap_error(error_class) { block.call(input) } - .lmap { |exception| error(input: input, message: exception.to_s) } + .lmap { |exception| error(input:, message: exception.to_s) } end end # Exception diff --git a/lib/mutant/variable.rb b/lib/mutant/variable.rb index b46f13940..a4178e347 100644 --- a/lib/mutant/variable.rb +++ b/lib/mutant/variable.rb @@ -163,8 +163,8 @@ def perform_put(value) # Execute block under mutex # # @return [self] - def synchronize(&block) - @mutex.synchronize(&block) + def synchronize(&) + @mutex.synchronize(&) end # Wait for block predicate diff --git a/lib/mutant/version.rb b/lib/mutant/version.rb index eb8485ae9..ff0426509 100644 --- a/lib/mutant/version.rb +++ b/lib/mutant/version.rb @@ -2,5 +2,5 @@ module Mutant # Current mutant version - VERSION = '0.12.2' + VERSION = '0.12.3' end # Mutant diff --git a/lib/mutant/world.rb b/lib/mutant/world.rb index 14f0f1c34..d59f5476f 100644 --- a/lib/mutant/world.rb +++ b/lib/mutant/world.rb @@ -53,9 +53,9 @@ def capture_command(command) (process_status.success? ? Either::Right : Either::Left).new( CommandStatus.new( - process_status: process_status, - stderr: stderr, - stdout: stdout + process_status:, + stderr:, + stdout: ) ) end @@ -79,16 +79,16 @@ def try_const_get(name) def deadline(allowed_time) if allowed_time Timer::Deadline.new( - allowed_time: allowed_time, - timer: timer + allowed_time:, + timer: ) else Timer::Deadline::None.new end end - def record(name, &block) - recorder.record(name, &block) + def record(name, &) + recorder.record(name, &) end def process_warmup diff --git a/meta/super.rb b/meta/super.rb index 9092dd574..84a3b4925 100644 --- a/meta/super.rb +++ b/meta/super.rb @@ -4,7 +4,6 @@ source 'super' singleton_mutations - mutation 'super()' end Mutant::Meta::Example.add :super do diff --git a/mutant-minitest.gemspec b/mutant-minitest.gemspec index c34a8e6fc..54f8e2524 100644 --- a/mutant-minitest.gemspec +++ b/mutant-minitest.gemspec @@ -17,7 +17,7 @@ Gem::Specification.new do |gem| gem.extra_rdoc_files = %w[LICENSE] - gem.required_ruby_version = '>= 3.0' + gem.required_ruby_version = '>= 3.1' gem.metadata['rubygems_mfa_required'] = 'true' diff --git a/mutant-rspec.gemspec b/mutant-rspec.gemspec index be39815fa..49fa863ee 100644 --- a/mutant-rspec.gemspec +++ b/mutant-rspec.gemspec @@ -18,7 +18,7 @@ Gem::Specification.new do |gem| gem.metadata['rubygems_mfa_required'] = 'true' - gem.required_ruby_version = '>= 3.0' + gem.required_ruby_version = '>= 3.1' gem.add_runtime_dependency('mutant', "= #{gem.version}") gem.add_runtime_dependency('rspec-core', '>= 3.8.0', '< 4.0.0') diff --git a/mutant.gemspec b/mutant.gemspec index 66aa5cf39..1a747c9b4 100644 --- a/mutant.gemspec +++ b/mutant.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |gem| gem.metadata['rubygems_mfa_required'] = 'true' gem.metadata['source_code_uri'] = 'https://github.com/mbj/mutant' - gem.required_ruby_version = '>= 3.0' + gem.required_ruby_version = '>= 3.1' gem.add_runtime_dependency('diff-lcs', '~> 1.3') gem.add_runtime_dependency('parser', '~> 3.3.0') diff --git a/spec/integration/mutant/parallel_spec.rb b/spec/integration/mutant/parallel_spec.rb index dbc95681d..19a474a60 100644 --- a/spec/integration/mutant/parallel_spec.rb +++ b/spec/integration/mutant/parallel_spec.rb @@ -31,14 +31,14 @@ def status jobs: 1, on_process_start: ->(index:) { puts("Booting: #{index}") }, process_name: 'test-parallel-process', - sink: sink, + sink:, source: Mutant::Parallel::Source::Array.new(jobs: [1, 2, 3]), thread_name: 'test-parallel-thread', timeout: 1.0 ) driver = Mutant::Parallel.async( - config: config, + config:, world: Mutant::WORLD ) @@ -79,14 +79,14 @@ def status jobs: 1, on_process_start: ->(index:) {}, process_name: 'test-parallel-process', - sink: sink, + sink:, source: Mutant::Parallel::Source::Array.new(jobs: [1, 2, 3]), thread_name: 'test-parallel-thread', timeout: 1.0 ) driver = Mutant::Parallel.async( - config: config, + config:, world: Mutant::WORLD ) @@ -124,14 +124,14 @@ def status jobs: 1, on_process_start: ->(_) { puts b }, process_name: 'test-parallel-process', - sink: sink, + sink:, source: Mutant::Parallel::Source::Array.new(jobs: [1, 2]), thread_name: 'test-parallel-thread', timeout: 1.0 ) driver = Mutant::Parallel.async( - config: config, + config:, world: Mutant::WORLD ) @@ -166,14 +166,14 @@ def status jobs: 1, on_process_start: ->(_) { Thread.start { i = 0; loop { puts(""); } } }, process_name: 'test-parallel-process', - sink: sink, + sink:, source: Mutant::Parallel::Source::Array.new(jobs: [1, 2, 3]), thread_name: 'test-parallel-thread', timeout: 1.0 ) driver = Mutant::Parallel.async( - config: config, + config:, world: Mutant::WORLD ) @@ -199,14 +199,14 @@ def status jobs: Etc.nprocessors, on_process_start: ->(index:) {}, process_name: 'test-parallel-process', - sink: sink, + sink:, source: Mutant::Parallel::Source::Array.new(jobs: Array.new(1000) { |value| value }), thread_name: 'test-parallel-thread', timeout: 1.0 ) driver = Mutant::Parallel.async( - config: config, + config:, world: Mutant::WORLD ) @@ -226,14 +226,14 @@ def status jobs: 1, on_process_start: ->(index:) {}, process_name: 'test-parallel-process', - sink: sink, + sink:, source: Mutant::Parallel::Source::Array.new(jobs: [1]), thread_name: 'test-parallel-thread', timeout: 1.0 ) driver = Mutant::Parallel.async( - config: config, + config:, world: Mutant::WORLD ) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 1477d9a14..251020280 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -51,7 +51,7 @@ module Fixtures ) recorder = Mutant::Segment::Recorder.new( - gen_id: gen_id, + gen_id:, root_id: root_segment.id, parent_id: root_segment.id, recording_start: 0, @@ -60,7 +60,7 @@ module Fixtures ) TEST_ENV = Mutant::Bootstrap - .call(Mutant::Env.empty(Mutant::WORLD.with(recorder: recorder), test_config)) + .call(Mutant::Env.empty(Mutant::WORLD.with(recorder:), test_config)) .from_right end # Fixtures @@ -89,11 +89,11 @@ def parse_expression(string) end # ParserHelper module XSpecHelper - def verify_events(&block) + def verify_events(&) expectations = raw_expectations .map { |attributes| XSpec::MessageExpectation.parse(**attributes) } - XSpec::ExpectationVerifier.verify(self, expectations, &block) + XSpec::ExpectationVerifier.verify(self, expectations, &) end def undefined diff --git a/spec/support/corpus.rb b/spec/support/corpus.rb index e9702031f..7a168f6a4 100644 --- a/spec/support/corpus.rb +++ b/spec/support/corpus.rb @@ -131,7 +131,7 @@ def parallel_config(sink) Mutant::Parallel::Config.new( block: method(:check_generation), jobs: Etc.nprocessors, - sink: sink, + sink:, timeout: nil, process_name: 'mutation-generation', source: Mutant::Parallel::Source::Array.new(jobs: effective_ruby_paths), @@ -184,7 +184,7 @@ def check_generation(path) mutations = Mutant::Mutator::Node.mutate( config: Mutant::Mutation::Config::DEFAULT.with(operators: Mutant::Mutation::Operators::Full.new), - node: node + node: ) mutations.each do |mutation| @@ -333,7 +333,7 @@ def system(arguments) path = ROOT.join('spec', 'integrations.yml') ALL = Transform::Named - .new(name: path, transform: transform) + .new(name: path, transform:) .call(path) .lmap(&:compact_message) .lmap(&method(:fail)) diff --git a/spec/support/file_system.rb b/spec/support/file_system.rb index a5e8862af..c0de2da32 100644 --- a/spec/support/file_system.rb +++ b/spec/support/file_system.rb @@ -24,7 +24,7 @@ class FakePathname def join(*arguments) self.class.new( - file_system: file_system, + file_system:, pathname: pathname.join(*arguments) ) end diff --git a/spec/support/ruby_vm.rb b/spec/support/ruby_vm.rb index 9d8a4aeac..7309e1f99 100644 --- a/spec/support/ruby_vm.rb +++ b/spec/support/ruby_vm.rb @@ -53,7 +53,7 @@ class Eval < self # A fake implementation of Kernel#require def require(logical_name) - handle_event(EventObservation.new(EventExpectation::Require, logical_name: logical_name)) + handle_event(EventObservation.new(EventExpectation::Require, logical_name:)) end # A fake implementation of Kernel#eval @@ -61,8 +61,8 @@ def eval(source, binding, location) handle_event( EventObservation.new( EventExpectation::Eval, - binding: binding, - source: source, + binding:, + source:, source_location: location ) ) diff --git a/spec/support/shared_context.rb b/spec/support/shared_context.rb index 019161161..364f31b3b 100644 --- a/spec/support/shared_context.rb +++ b/spec/support/shared_context.rb @@ -19,7 +19,7 @@ def with(name, &block) def it_reports(expected_content) it 'writes expected report to output' do - described_class.call(output: output, object: reportable) + described_class.call(output:, object: reportable) output.rewind expect(output.read).to eql(expected_content) end @@ -67,21 +67,21 @@ def setup_shared_context amount_subjects: subjects.length, amount_all_tests: integration.all_tests.length, amount_available_tests: integration.available_tests.length, - config: config, - integration: integration, - mutations: mutations, + config:, + integration:, + mutations:, selected_tests: [test_a].to_set, - selections: selections, - subjects: subjects, + selections:, + subjects:, test_subject_ratio: Rational(1), - world: world + world: ) end let(:world) do instance_double( Mutant::World, - timer: timer + timer: ) end @@ -129,7 +129,7 @@ def setup_shared_context let(:subject_a_context) do Mutant::Context.new( constant_scope: Mutant::Context::ConstantScope::None.new, - scope: scope, + scope:, source_path: 'subject-a.rb' ) end @@ -150,7 +150,7 @@ def setup_shared_context let(:env_result) do Mutant::Result::Env.new( - env: env, + env:, runtime: 4.0, subject_results: [subject_a_result] ) diff --git a/spec/support/xspec.rb b/spec/support/xspec.rb index af4058fe6..d112fb7c6 100644 --- a/spec/support/xspec.rb +++ b/spec/support/xspec.rb @@ -26,7 +26,7 @@ def call(observation) def self.parse(events) event_list = events.to_a assert_valid(event_list) - new(event_list: event_list) + new(event_list:) end private @@ -103,16 +103,16 @@ class MessageExpectation # rubocop:disable Metrics/ParameterLists def self.parse(receiver:, selector:, arguments: [], reaction: nil, pre_action: nil) new( - receiver: receiver, - selector: selector, - arguments: arguments, - pre_action: pre_action, + receiver:, + selector:, + arguments:, + pre_action:, reaction: MessageReaction.parse(reaction || { return: nil }) ) end def call(observation) - Verifier.new(expectation: self, observation: observation).call + Verifier.new(expectation: self, observation:).call end class Verifier @@ -163,7 +163,7 @@ def assert_done # rubocop:disable Metrics/MethodLength def self.verify(rspec_context, expectations) - verifier = new(expectations: expectations) + verifier = new(expectations:) hooks = expectations .to_set { |expectation| [expectation.receiver, expectation.selector] } @@ -173,10 +173,10 @@ def self.verify(rspec_context, expectations) allow(receiver).to receive(selector) do |*arguments, &block| verifier.call( MessageObservation.new( - receiver: receiver, - selector: selector, - arguments: arguments, - block: block + receiver:, + selector:, + arguments:, + block: ) ) end diff --git a/spec/unit/mutant/ast/find_metaclass_containing_spec.rb b/spec/unit/mutant/ast/find_metaclass_containing_spec.rb index 043fda864..a49eaac24 100644 --- a/spec/unit/mutant/ast/find_metaclass_containing_spec.rb +++ b/spec/unit/mutant/ast/find_metaclass_containing_spec.rb @@ -2,7 +2,7 @@ RSpec.describe Mutant::AST::FindMetaclassContaining do describe '#call' do - subject { described_class.call(ast: ast, target: node) } + subject { described_class.call(ast:, target: node) } let(:metaclass_node) { s(:sclass, s(:self), method_node) } let(:method_node) { s(:def, 'test', s(:nil)) } diff --git a/spec/unit/mutant/ast/meta/optarg_spec.rb b/spec/unit/mutant/ast/meta/optarg_spec.rb index 0fc7461f8..54777d77f 100644 --- a/spec/unit/mutant/ast/meta/optarg_spec.rb +++ b/spec/unit/mutant/ast/meta/optarg_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe Mutant::AST::Meta::Optarg do - subject(:object) { described_class.new(node: node) } + subject(:object) { described_class.new(node:) } let(:node) { s(:optarg, name, value) } let(:name) { :foo } diff --git a/spec/unit/mutant/ast/meta/send/proc_predicate_spec.rb b/spec/unit/mutant/ast/meta/send/proc_predicate_spec.rb index 59251050a..61c10200b 100644 --- a/spec/unit/mutant/ast/meta/send/proc_predicate_spec.rb +++ b/spec/unit/mutant/ast/meta/send/proc_predicate_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe Mutant::AST::Meta::Send, '#proc?' do - subject { described_class.new(node: node).proc? } + subject { described_class.new(node:).proc? } shared_context 'proc send' do |source| let(:node) { Unparser.parse(source).children.first } diff --git a/spec/unit/mutant/ast/meta/send/receiver_possible_top_level_const_predicate_spec.rb b/spec/unit/mutant/ast/meta/send/receiver_possible_top_level_const_predicate_spec.rb index 663c70a9a..a28acb46c 100644 --- a/spec/unit/mutant/ast/meta/send/receiver_possible_top_level_const_predicate_spec.rb +++ b/spec/unit/mutant/ast/meta/send/receiver_possible_top_level_const_predicate_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe Mutant::AST::Meta::Send, '#receiver_possible_top_level_const?' do - subject { described_class.new(node: node).receiver_possible_top_level_const? } + subject { described_class.new(node:).receiver_possible_top_level_const? } def parse(source) Unparser.parse(source) diff --git a/spec/unit/mutant/ast/meta/send_spec.rb b/spec/unit/mutant/ast/meta/send_spec.rb index eafedadf4..ee01391bf 100644 --- a/spec/unit/mutant/ast/meta/send_spec.rb +++ b/spec/unit/mutant/ast/meta/send_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe Mutant::AST::Meta::Send do - let(:object) { described_class.new(node: node) } + let(:object) { described_class.new(node:) } def parse(source) Unparser.parse(source) diff --git a/spec/unit/mutant/ast/named_children_spec.rb b/spec/unit/mutant/ast/named_children_spec.rb index 4a999877a..efadef003 100644 --- a/spec/unit/mutant/ast/named_children_spec.rb +++ b/spec/unit/mutant/ast/named_children_spec.rb @@ -18,7 +18,7 @@ def publish end end - let(:instance) { klass.new(node: node) } + let(:instance) { klass.new(node:) } let(:node_foo) { s(:foo) } let(:node_bar) { s(:bar) } diff --git a/spec/unit/mutant/ast/pattern/deep_spec.rb b/spec/unit/mutant/ast/pattern/deep_spec.rb index bbb250b89..34fe4c4af 100644 --- a/spec/unit/mutant/ast/pattern/deep_spec.rb +++ b/spec/unit/mutant/ast/pattern/deep_spec.rb @@ -2,7 +2,7 @@ RSpec.describe Mutant::AST::Pattern::Deep do let(:instance) do - described_class.new(pattern: pattern) + described_class.new(pattern:) end let(:node) do diff --git a/spec/unit/mutant/ast/pattern/node_spec.rb b/spec/unit/mutant/ast/pattern/node_spec.rb index e52f175f0..c41e0325a 100644 --- a/spec/unit/mutant/ast/pattern/node_spec.rb +++ b/spec/unit/mutant/ast/pattern/node_spec.rb @@ -34,7 +34,7 @@ def apply let(:instance) do described_class.new( type: :send, - attribute: attribute + attribute: ) end @@ -67,7 +67,7 @@ def apply let(:instance) do described_class.new( type: :send, - descendant: descendant + descendant: ) end @@ -87,8 +87,8 @@ def apply let(:instance) do described_class.new( type: :send, - attribute: attribute, - descendant: descendant + attribute:, + descendant: ) end @@ -129,7 +129,7 @@ def apply let(:instance) do described_class.new( type: :str, - attribute: attribute + attribute: ) end diff --git a/spec/unit/mutant/ast/pattern/source/location_spec.rb b/spec/unit/mutant/ast/pattern/source/location_spec.rb index 983fe48a3..ba0bb3514 100644 --- a/spec/unit/mutant/ast/pattern/source/location_spec.rb +++ b/spec/unit/mutant/ast/pattern/source/location_spec.rb @@ -6,7 +6,7 @@ line_index: 1, line_start: 1, range: 3..4, - source: source + source: ) end diff --git a/spec/unit/mutant/ast/pattern/source_spec.rb b/spec/unit/mutant/ast/pattern/source_spec.rb index 8d7fa4255..57c715935 100644 --- a/spec/unit/mutant/ast/pattern/source_spec.rb +++ b/spec/unit/mutant/ast/pattern/source_spec.rb @@ -9,7 +9,7 @@ def apply let(:string) { "a\n b" } let(:instance) do - described_class.new(string: string) + described_class.new(string:) end context 'on line index 0' do diff --git a/spec/unit/mutant/ast_spec.rb b/spec/unit/mutant/ast_spec.rb index c6f116962..f8efddf8e 100644 --- a/spec/unit/mutant/ast_spec.rb +++ b/spec/unit/mutant/ast_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe Mutant::AST do - let(:object) { described_class.new(comment_associations: [], node: node) } + let(:object) { described_class.new(comment_associations: [], node:) } describe '#on_line' do def apply(line) @@ -29,7 +29,7 @@ def foo it 'returns expected view' do expect(apply(2)).to eql( [ - described_class::View.new(node: node, stack: []) + described_class::View.new(node:, stack: []) ] ) end diff --git a/spec/unit/mutant/bootstrap_spec.rb b/spec/unit/mutant/bootstrap_spec.rb index 9de9fca47..828e4fdcc 100644 --- a/spec/unit/mutant/bootstrap_spec.rb +++ b/spec/unit/mutant/bootstrap_spec.rb @@ -23,7 +23,7 @@ end let(:env_initial) do - Mutant::Env.empty(world, config).with(hooks: hooks) + Mutant::Env.empty(world, config).with(hooks:) end let(:fake_kernel) do @@ -35,7 +35,7 @@ def require(_); end let(:matcher_config) do Mutant::Matcher::Config::DEFAULT.with( subjects: subject_expressions, - start_expressions: start_expressions + start_expressions: ) end @@ -43,12 +43,12 @@ def require(_); end instance_double( Mutant::World, environment_variables: {}, - kernel: kernel, - load_path: load_path, - object_space: object_space, + kernel:, + load_path:, + object_space:, pathname: Pathname, recorder: instance_double(Mutant::Segment::Recorder), - timer: timer + timer: ) end @@ -66,8 +66,8 @@ def require(_); end let(:expected_env) do env_with_scopes.with( - integration: integration, - selector: Mutant::Selector::Expression.new(integration: integration) + integration:, + selector: Mutant::Selector::Expression.new(integration:) ) end @@ -316,7 +316,7 @@ def object.name end let(:expected_subjects) do - Mutant::Matcher::Scope.new(scope: scope).call(env_initial) + Mutant::Matcher::Scope.new(scope:).call(env_initial) end let(:expected_env) do @@ -347,7 +347,7 @@ def object.name ) Mutant::Matcher::Scope - .new(scope: scope) + .new(scope:) .call(Mutant::Env.empty(world, config)).last end @@ -370,8 +370,8 @@ def apply let(:expected_env) do env_initial.with( - integration: integration, - selector: Mutant::Selector::Expression.new(integration: integration) + integration:, + selector: Mutant::Selector::Expression.new(integration:) ) end diff --git a/spec/unit/mutant/cli_spec.rb b/spec/unit/mutant/cli_spec.rb index 3afed3896..67b534319 100644 --- a/spec/unit/mutant/cli_spec.rb +++ b/spec/unit/mutant/cli_spec.rb @@ -13,11 +13,11 @@ let(:world) do instance_double( Mutant::World, - kernel: kernel, + kernel:, recorder: instance_double(Mutant::Segment::Recorder), - stderr: stderr, - stdout: stdout, - timer: timer + stderr:, + stdout:, + timer: ) end @@ -35,7 +35,7 @@ def apply described_class.parse( arguments: Marshal.load(Marshal.dump(arguments)), - world: world + world: ) end @@ -683,9 +683,9 @@ def self.main_body integration: instance_double( Mutant::Integration, all_tests: [test_a, test_b, test_c], - available_tests: available_tests + available_tests: ), - subjects: subjects + subjects: ) end @@ -703,7 +703,7 @@ def self.main_body let(:subject_a) do Mutant::Subject::Method::Instance.new( config: Mutant::Subject::Config::DEFAULT, - context: Mutant::Context.new(constant_scope: constant_scope, scope: scope, source_path: 'subject.rb'), + context: Mutant::Context.new(constant_scope:, scope:, source_path: 'subject.rb'), node: s(:def, :send, s(:args), nil), visibility: :public ) @@ -774,7 +774,7 @@ def self.main_body ], [ :load_config, - { cli_config: expected_cli_config, world: world }.inspect + { cli_config: expected_cli_config, world: }.inspect ], [ :bootstrap, @@ -815,7 +815,7 @@ def self.main_body ], [ :load_config, - { cli_config: expected_cli_config, world: world }.inspect + { cli_config: expected_cli_config, world: }.inspect ], [ :test_bootstrap, @@ -866,7 +866,7 @@ def self.main_body ], [ :load_config, - { cli_config: expected_cli_config, world: world }.inspect + { cli_config: expected_cli_config, world: }.inspect ], [ :test_bootstrap, @@ -924,7 +924,7 @@ def self.main_body cli_config: expected_cli_config.with( reporter: expected_cli_config.reporter.with(print_warnings: true) ), - world: world + world: }.inspect ], [ @@ -963,7 +963,7 @@ def self.main_body ], [ :load_config, - { cli_config: expected_cli_config, world: world }.inspect + { cli_config: expected_cli_config, world: }.inspect ], [ :bootstrap, @@ -1021,7 +1021,7 @@ def self.main_body ], [ :load_config, - { cli_config: expected_cli_config, world: world }.inspect + { cli_config: expected_cli_config, world: }.inspect ], [ :bootstrap, @@ -1049,7 +1049,7 @@ def self.main_body ], [ :load_config, - { cli_config: expected_cli_config, world: world }.inspect + { cli_config: expected_cli_config, world: }.inspect ], [ :bootstrap, @@ -1227,7 +1227,7 @@ def self.main_body ], [ :load_config, - { cli_config: expected_cli_config, world: world }.inspect + { cli_config: expected_cli_config, world: }.inspect ], [ :bootstrap, @@ -1400,7 +1400,7 @@ def self.main_body let(:arguments) { super() + ['--since', 'reference'] } let(:expected_cli_config) do - diff = Mutant::Repository::Diff.new(to: 'reference', world: world) + diff = Mutant::Repository::Diff.new(to: 'reference', world:) super().with(matcher: super().matcher.with(diffs: [diff])) end diff --git a/spec/unit/mutant/config/coverage_criteria_spec.rb b/spec/unit/mutant/config/coverage_criteria_spec.rb index c63dbb8ba..6c877ae45 100644 --- a/spec/unit/mutant/config/coverage_criteria_spec.rb +++ b/spec/unit/mutant/config/coverage_criteria_spec.rb @@ -4,9 +4,9 @@ describe '#merge' do let(:original) do described_class.new( - test_result: test_result, - timeout: timeout, - process_abort: process_abort + test_result:, + timeout:, + process_abort: ) end diff --git a/spec/unit/mutant/config_spec.rb b/spec/unit/mutant/config_spec.rb index 7b5315ecd..4a1ba941b 100644 --- a/spec/unit/mutant/config_spec.rb +++ b/spec/unit/mutant/config_spec.rb @@ -255,12 +255,12 @@ def expect_value(value) describe '.load' do def apply - described_class.load(cli_config: cli_config, world: world) + described_class.load(cli_config:, world:) end let(:cli_config) { Mutant::Config::DEFAULT } let(:nprocessors) { instance_double(Integer, :nprocessors) } - let(:world) { instance_double(Mutant::World, pathname: pathname) } + let(:world) { instance_double(Mutant::World, pathname:) } let(:pathname) do paths = paths() @@ -291,7 +291,7 @@ def apply before do allow(Pathname).to receive(:new, &paths.public_method(:fetch)) - allow(Etc).to receive_messages(nprocessors: nprocessors) + allow(Etc).to receive_messages(nprocessors:) end context 'when no path is readable' do diff --git a/spec/unit/mutant/context_spec.rb b/spec/unit/mutant/context_spec.rb index 9df6f3271..c9783001b 100644 --- a/spec/unit/mutant/context_spec.rb +++ b/spec/unit/mutant/context_spec.rb @@ -3,9 +3,9 @@ RSpec.describe Mutant::Context do let(:object) do described_class.new( - constant_scope: constant_scope, - scope: scope, - source_path: source_path + constant_scope:, + scope:, + source_path: ) end diff --git a/spec/unit/mutant/env_spec.rb b/spec/unit/mutant/env_spec.rb index e7c623c6a..e168bea75 100644 --- a/spec/unit/mutant/env_spec.rb +++ b/spec/unit/mutant/env_spec.rb @@ -3,15 +3,15 @@ RSpec.describe Mutant::Env do subject do described_class.new( - config: config, - hooks: hooks, - integration: integration, + config:, + hooks:, + integration:, matchable_scopes: [], mutations: [mutation], parser: Mutant::Parser.new, - selector: selector, - subjects: subjects, - world: world + selector:, + subjects:, + world: ) end @@ -49,9 +49,9 @@ Mutant::Config, expression_parser: instance_double(Mutant::Expression::Parser), integration: Mutant::Integration::Config::DEFAULT.with(name: integration_name), - isolation: isolation, + isolation:, mutation: mutation_config, - reporter: reporter + reporter: ) end @@ -71,9 +71,9 @@ def isolation_success(value) Mutant::Isolation::Result.new( log: '', exception: nil, - process_status: process_status, + process_status:, timeout: nil, - value: value + value: ) end @@ -130,8 +130,8 @@ def apply it 'returns expected result' do expect(apply).to eql( Mutant::Result::MutationIndex.new( - isolation_result: isolation_result, - mutation_index: mutation_index, + isolation_result:, + mutation_index:, runtime: 1.0 ) ) @@ -151,9 +151,9 @@ def apply apply expect(isolation).to have_received(:call).ordered.with(config.mutation.timeout) - expect(hooks).to have_received(:run).ordered.with(:mutation_insert_pre, mutation: mutation) + expect(hooks).to have_received(:run).ordered.with(:mutation_insert_pre, mutation:) expect(mutation).to have_received(:insert).ordered.with(world.kernel) - expect(hooks).to have_received(:run).ordered.with(:mutation_insert_post, mutation: mutation) + expect(hooks).to have_received(:run).ordered.with(:mutation_insert_post, mutation:) expect(integration).to have_received(:call).ordered.with([test_a, test_b]) end @@ -182,7 +182,7 @@ def apply let(:index) { 0 } def apply - subject.emit_mutation_worker_process_start(index: index) + subject.emit_mutation_worker_process_start(index:) end before do @@ -192,7 +192,7 @@ def apply it 'dispatches expected hook' do apply - expect(hooks).to have_received(:run).with(:mutation_worker_process_start, index: index) + expect(hooks).to have_received(:run).with(:mutation_worker_process_start, index:) end end @@ -200,7 +200,7 @@ def apply let(:index) { 0 } def apply - subject.emit_test_worker_process_start(index: index) + subject.emit_test_worker_process_start(index:) end before do @@ -210,7 +210,7 @@ def apply it 'dispatches expected hook' do apply - expect(hooks).to have_received(:run).with(:test_worker_process_start, index: index) + expect(hooks).to have_received(:run).with(:test_worker_process_start, index:) end end @@ -298,20 +298,20 @@ def apply integration = Mutant::Integration::Null.new( arguments: Mutant::EMPTY_ARRAY, expression_parser: config.expression_parser, - world: world + world: ) expect(apply).to eql( described_class.new( - config: config, + config:, hooks: Mutant::Hooks.empty, - integration: integration, + integration:, matchable_scopes: Mutant::EMPTY_ARRAY, mutations: Mutant::EMPTY_ARRAY, parser: Mutant::Parser.new, selector: Mutant::Selector::Null.new, subjects: Mutant::EMPTY_ARRAY, - world: world + world: ) ) end diff --git a/spec/unit/mutant/expression/methods_spec.rb b/spec/unit/mutant/expression/methods_spec.rb index 91010e7a0..9d52ef63c 100644 --- a/spec/unit/mutant/expression/methods_spec.rb +++ b/spec/unit/mutant/expression/methods_spec.rb @@ -63,7 +63,7 @@ specify do should eql( Mutant::Matcher::Chain.new( - matchers: [Mutant::Matcher::Methods::Instance.new(scope: scope)] + matchers: [Mutant::Matcher::Methods::Instance.new(scope:)] ) ) end @@ -76,8 +76,8 @@ should eql( Mutant::Matcher::Chain.new( matchers: [ - Mutant::Matcher::Methods::Singleton.new(scope: scope), - Mutant::Matcher::Methods::Metaclass.new(scope: scope) + Mutant::Matcher::Methods::Singleton.new(scope:), + Mutant::Matcher::Methods::Metaclass.new(scope:) ] ) ) diff --git a/spec/unit/mutant/expression/namespace/exact_spec.rb b/spec/unit/mutant/expression/namespace/exact_spec.rb index 84eb3a18a..7b22a183b 100644 --- a/spec/unit/mutant/expression/namespace/exact_spec.rb +++ b/spec/unit/mutant/expression/namespace/exact_spec.rb @@ -21,7 +21,7 @@ end context 'when constant exists' do - it { should eql(Mutant::Matcher::Scope.new(scope: scope)) } + it { should eql(Mutant::Matcher::Scope.new(scope:)) } end end diff --git a/spec/unit/mutant/expression/source_spec.rb b/spec/unit/mutant/expression/source_spec.rb index fd69dc980..fe81c4a18 100644 --- a/spec/unit/mutant/expression/source_spec.rb +++ b/spec/unit/mutant/expression/source_spec.rb @@ -6,7 +6,7 @@ describe '#matcher' do def apply - object.matcher(env: env) + object.matcher(env:) end let(:glob_expression) { 'lib/**/*.rb' } @@ -16,7 +16,7 @@ def apply let(:path_a) { instance_double(Pathname, :a) } let(:path_b) { instance_double(Pathname, :b) } let(:pathname) { class_double(Pathname) } - let(:world) { instance_double(Mutant::World, pathname: pathname) } + let(:world) { instance_double(Mutant::World, pathname:) } let(:path_asts) do { @@ -49,10 +49,10 @@ def apply let(:env) do instance_double( Mutant::Env, - config: config, + config:, matchable_scopes: [scope_a, scope_b], - parser: parser, - world: world + parser:, + world: ) end diff --git a/spec/unit/mutant/integration/rspec_spec.rb b/spec/unit/mutant/integration/rspec_spec.rb index 8c632ca1d..363407b66 100644 --- a/spec/unit/mutant/integration/rspec_spec.rb +++ b/spec/unit/mutant/integration/rspec_spec.rb @@ -7,7 +7,7 @@ described_class.new( arguments: integration_arguments, expression_parser: Mutant::Config::DEFAULT.expression_parser, - world: world + world: ) end @@ -113,10 +113,10 @@ let(:rspec_world) do instance_double( RSpec::Core::World, - example_groups: example_groups, - filtered_examples: filtered_examples, - ordered_example_groups: ordered_example_groups, - wants_to_quit: wants_to_quit + example_groups:, + filtered_examples:, + ordered_example_groups:, + wants_to_quit: ) end @@ -258,7 +258,7 @@ def apply let(:supports_is_quitting) { true } before do - allow(rspec_world).to receive_messages(rspec_is_quitting: rspec_is_quitting) + allow(rspec_world).to receive_messages(rspec_is_quitting:) end context 'and its currently quitting' do diff --git a/spec/unit/mutant/integration_spec.rb b/spec/unit/mutant/integration_spec.rb index 4954c8d08..eeed4f836 100644 --- a/spec/unit/mutant/integration_spec.rb +++ b/spec/unit/mutant/integration_spec.rb @@ -4,8 +4,8 @@ let(:object) do Class.new(described_class).new( arguments: [], - expression_parser: expression_parser, - world: world + expression_parser:, + world: ) end @@ -35,15 +35,15 @@ def apply instance_double( Mutant::Config, integration: Mutant::Integration::Config::DEFAULT.with(name: integration_name), - expression_parser: expression_parser + expression_parser: ) end let(:env) do instance_double( Mutant::Env, - config: config, - world: world + config:, + world: ) end @@ -133,8 +133,8 @@ def apply let(:object) do described_class.new( arguments: %w[argument-a argument-b], - expression_parser: expression_parser, - world: world + expression_parser:, + world: ) end diff --git a/spec/unit/mutant/isolation/fork_spec.rb b/spec/unit/mutant/isolation/fork_spec.rb index ae72c56e9..61e4ca791 100644 --- a/spec/unit/mutant/isolation/fork_spec.rb +++ b/spec/unit/mutant/isolation/fork_spec.rb @@ -168,7 +168,7 @@ def kill end describe '#call' do - subject { described_class.new(world: world) } + subject { described_class.new(world:) } def apply subject.call(timeout, &isolated_block) @@ -488,7 +488,7 @@ def timer(now) selector: :load, arguments: [result_fragment], reaction: { - exception: exception + exception: } }, child_nowait(child_status_success) diff --git a/spec/unit/mutant/isolation/none_spec.rb b/spec/unit/mutant/isolation/none_spec.rb index dd7edf8c2..e76f9201c 100644 --- a/spec/unit/mutant/isolation/none_spec.rb +++ b/spec/unit/mutant/isolation/none_spec.rb @@ -26,7 +26,7 @@ it 'returns error result' do expect(object.call(timeout) { fail exception }).to eql( Mutant::Isolation::Result.new( - exception: exception, + exception:, log: '', process_status: nil, timeout: nil, diff --git a/spec/unit/mutant/isolation/result_spec.rb b/spec/unit/mutant/isolation/result_spec.rb index 9226c6533..f8ed65509 100644 --- a/spec/unit/mutant/isolation/result_spec.rb +++ b/spec/unit/mutant/isolation/result_spec.rb @@ -3,10 +3,10 @@ RSpec.describe Mutant::Isolation::Result do let(:object) do described_class.new( - exception: exception, + exception:, log: '', - process_status: process_status, - timeout: timeout, + process_status:, + timeout:, value: nil ) end diff --git a/spec/unit/mutant/loader_spec.rb b/spec/unit/mutant/loader_spec.rb index 5091a0aab..0204b3b8c 100644 --- a/spec/unit/mutant/loader_spec.rb +++ b/spec/unit/mutant/loader_spec.rb @@ -3,9 +3,9 @@ RSpec.describe Mutant::Loader, '.call' do def apply described_class.call( - binding: binding, - kernel: kernel, - source: source, + binding:, + kernel:, + source:, subject: mutation_subject ) end diff --git a/spec/unit/mutant/matcher/descendants_spec.rb b/spec/unit/mutant/matcher/descendants_spec.rb index 184b8a19c..8fd8f0692 100644 --- a/spec/unit/mutant/matcher/descendants_spec.rb +++ b/spec/unit/mutant/matcher/descendants_spec.rb @@ -4,7 +4,7 @@ let(:env) { Fixtures::TEST_ENV } describe '#call' do - subject { described_class.new(const_name: const_name) } + subject { described_class.new(const_name:) } def apply subject.call(env) @@ -31,7 +31,7 @@ def apply Mutant::Subject::Method::Instance.new( config: Mutant::Subject::Config::DEFAULT, context: Mutant::Context.new( - constant_scope: constant_scope, + constant_scope:, scope: Mutant::Scope.new( raw: TestApp::Foo::Bar::Baz, expression: parse_expression('TestApp::Foo::Bar::Baz') diff --git a/spec/unit/mutant/matcher/filter_spec.rb b/spec/unit/mutant/matcher/filter_spec.rb index 3b8f782d3..06d0253d9 100644 --- a/spec/unit/mutant/matcher/filter_spec.rb +++ b/spec/unit/mutant/matcher/filter_spec.rb @@ -3,7 +3,7 @@ RSpec.describe Mutant::Matcher::Filter, '#call' do subject { object.call(env) } - let(:object) { described_class.new(matcher: matcher, predicate: predicate) } + let(:object) { described_class.new(matcher:, predicate:) } let(:matcher) { instance_double(Mutant::Matcher) } let(:subject_a) { instance_double(Mutant::Subject) } let(:subject_b) { instance_double(Mutant::Subject) } diff --git a/spec/unit/mutant/matcher/method/instance_spec.rb b/spec/unit/mutant/matcher/method/instance_spec.rb index 83ddc390a..4935b14d3 100644 --- a/spec/unit/mutant/matcher/method/instance_spec.rb +++ b/spec/unit/mutant/matcher/method/instance_spec.rb @@ -7,7 +7,7 @@ let(:method) { scope.raw.instance_method(method_name) } let(:method_arity) { 0 } let(:method_name) { :foo } - let(:object) { described_class.new(scope: scope, target_method: method) } + let(:object) { described_class.new(scope:, target_method: method) } let(:source_path) { MutantSpec::ROOT.join('test_app/lib/test_app.rb') } let(:type) { :def } @@ -25,9 +25,9 @@ let(:env) do instance_double( Mutant::Env, - config: config, + config:, parser: Fixtures::TEST_ENV.parser, - world: world + world: ) end @@ -55,7 +55,7 @@ def arguments Method, name: :some_method, owner: nil, - source_location: source_location + source_location: ) end @@ -69,7 +69,7 @@ def arguments end context 'when method is defined inside of a file removed by a diff filter' do - let(:config) { super().with(matcher: super().matcher.with(diffs: diffs)) } + let(:config) { super().with(matcher: super().matcher.with(diffs:)) } let(:diff_a) { instance_double(Mutant::Repository::Diff, :diff_a) } let(:diff_a_touches?) { false } let(:diff_b) { instance_double(Mutant::Repository::Diff, :diff_b) } @@ -232,8 +232,8 @@ def arguments let(:context) do Mutant::Context.new( - constant_scope: constant_scope, - scope: scope, + constant_scope:, + scope:, source_path: MutantSpec::ROOT.join('test_app', 'lib', 'test_app.rb') ) end @@ -242,7 +242,7 @@ def arguments [ Mutant::Subject::Method::Instance.new( config: Mutant::Subject::Config::DEFAULT, - context: context, + context:, node: s(:def, :bar, s(:args), nil), visibility: expected_visibility ) diff --git a/spec/unit/mutant/matcher/method/metaclass_spec.rb b/spec/unit/mutant/matcher/method/metaclass_spec.rb index e5dd2f384..33ba95007 100644 --- a/spec/unit/mutant/matcher/method/metaclass_spec.rb +++ b/spec/unit/mutant/matcher/method/metaclass_spec.rb @@ -5,7 +5,7 @@ subject { object.call(env) } - let(:object) { described_class.new(scope: scope, target_method: method) } + let(:object) { described_class.new(scope:, target_method: method) } let(:method) { scope.raw.public_method(method_name) } let(:type) { :def } let(:method_name) { :foo } @@ -25,7 +25,7 @@ Mutant::Env, config: Mutant::Config::DEFAULT, parser: Fixtures::TEST_ENV.parser, - world: world + world: ) end diff --git a/spec/unit/mutant/matcher/method/singleton_spec.rb b/spec/unit/mutant/matcher/method/singleton_spec.rb index b90aa16af..997d026b7 100644 --- a/spec/unit/mutant/matcher/method/singleton_spec.rb +++ b/spec/unit/mutant/matcher/method/singleton_spec.rb @@ -3,7 +3,7 @@ RSpec.describe Mutant::Matcher::Method::Singleton, '#call' do subject { object.call(env) } - let(:object) { described_class.new(scope: scope, target_method: method) } + let(:object) { described_class.new(scope:, target_method: method) } let(:method) { scope.raw.method(method_name) } let(:type) { :defs } let(:method_name) { :foo } @@ -23,7 +23,7 @@ Mutant::Env, config: Mutant::Config::DEFAULT, parser: Fixtures::TEST_ENV.parser, - world: world + world: ) end @@ -70,7 +70,7 @@ def arguments end it 'returns expected subjects' do - expect(subject).to eql([mutation_subject.with(visibility: visibility)]) + expect(subject).to eql([mutation_subject.with(visibility:)]) end end end diff --git a/spec/unit/mutant/matcher/methods/instance_spec.rb b/spec/unit/mutant/matcher/methods/instance_spec.rb index 8944e4a95..257431a70 100644 --- a/spec/unit/mutant/matcher/methods/instance_spec.rb +++ b/spec/unit/mutant/matcher/methods/instance_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe Mutant::Matcher::Methods::Instance, '#call' do - let(:object) { described_class.new(scope: scope) } + let(:object) { described_class.new(scope:) } let(:scope) do Mutant::Scope.new( @@ -83,7 +83,7 @@ def method_c; end expect(matcher).to receive(:call).with(env).and_return([subject]) expect(Mutant::Matcher::Method::Instance).to receive(:new) - .with(scope: scope, target_method: class_under_test.instance_method(method)) + .with(scope:, target_method: class_under_test.instance_method(method)) .and_return(matcher) end end @@ -94,7 +94,7 @@ def method_c; end end context 'on degenerate object interface' do - let(:object) { described_class.new(scope: scope) } + let(:object) { described_class.new(scope:) } let(:scope) do Mutant::Scope.new( @@ -130,7 +130,7 @@ def apply exception end - expect(capture_reporter.warnings).to eql([<<~'MESSAGE' % { scope: scope, exception: exception.inspect }]) + expect(capture_reporter.warnings).to eql([<<~'MESSAGE' % { scope:, exception: exception.inspect }]) Caught an exception while accessing a method with #instance_method that is part of #{public,private,protected}_instance_methods. diff --git a/spec/unit/mutant/matcher/methods/metaclass_spec.rb b/spec/unit/mutant/matcher/methods/metaclass_spec.rb index ef4430469..d4621d355 100644 --- a/spec/unit/mutant/matcher/methods/metaclass_spec.rb +++ b/spec/unit/mutant/matcher/methods/metaclass_spec.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true RSpec.describe Mutant::Matcher::Methods::Metaclass, '#call' do - let(:object) { described_class.new(scope: scope) } - let(:env) { Fixtures::TEST_ENV } + let(:object) { described_class.new(scope:) } + let(:env) { Fixtures::TEST_ENV } let(:scope) do Mutant::Scope.new( @@ -58,7 +58,7 @@ def method_c; end method_c: subject_c }.each do |method, subject| allow(matcher).to receive(:new) - .with(scope: scope, target_method: class_under_test.method(method)) + .with(scope:, target_method: class_under_test.method(method)) .and_return(Mutant::Matcher::Static.new(subjects: [subject])) end end diff --git a/spec/unit/mutant/matcher/methods/singleton_spec.rb b/spec/unit/mutant/matcher/methods/singleton_spec.rb index 0c37f26be..be9f4b07b 100644 --- a/spec/unit/mutant/matcher/methods/singleton_spec.rb +++ b/spec/unit/mutant/matcher/methods/singleton_spec.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true RSpec.describe Mutant::Matcher::Methods::Singleton, '#call' do - let(:object) { described_class.new(scope: scope) } - let(:env) { Fixtures::TEST_ENV } + let(:object) { described_class.new(scope:) } + let(:env) { Fixtures::TEST_ENV } let(:class_under_test) do parent = Module.new do @@ -47,7 +47,7 @@ def self.method_c; end method_c: subject_c }.each do |method, subject| allow(matcher).to receive(:new) - .with(scope: scope, target_method: class_under_test.method(method)) + .with(scope:, target_method: class_under_test.method(method)) .and_return(Mutant::Matcher::Static.new(subjects: [subject])) end end diff --git a/spec/unit/mutant/matcher/scope_spec.rb b/spec/unit/mutant/matcher/scope_spec.rb index 84fbb8e6f..9ccaa0917 100644 --- a/spec/unit/mutant/matcher/scope_spec.rb +++ b/spec/unit/mutant/matcher/scope_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe Mutant::Matcher::Scope, '#call' do - let(:object) { described_class.new(scope: scope) } + let(:object) { described_class.new(scope:) } let(:env) { instance_double(Mutant::Env) } let(:matcher_a) { instance_double(Mutant::Matcher) } let(:matcher_b) { instance_double(Mutant::Matcher) } @@ -21,15 +21,15 @@ before do expect(Mutant::Matcher::Methods::Singleton).to receive(:new) - .with(scope: scope) + .with(scope:) .and_return(matcher_a) expect(Mutant::Matcher::Methods::Instance).to receive(:new) - .with(scope: scope) + .with(scope:) .and_return(matcher_b) expect(Mutant::Matcher::Methods::Metaclass).to receive(:new) - .with(scope: scope) + .with(scope:) .and_return(matcher_c) expect(matcher_a).to receive(:call) diff --git a/spec/unit/mutant/matcher/static_spec.rb b/spec/unit/mutant/matcher/static_spec.rb index 24967017b..5f2d68302 100644 --- a/spec/unit/mutant/matcher/static_spec.rb +++ b/spec/unit/mutant/matcher/static_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe Mutant::Matcher::Static, '#call' do - let(:object) { described_class.new(subjects: subjects) } + let(:object) { described_class.new(subjects:) } let(:env) { instance_double(Mutant::Env) } let(:subjects) { instance_double(Array) } diff --git a/spec/unit/mutant/matcher_spec.rb b/spec/unit/mutant/matcher_spec.rb index e740a3f29..0b4d61056 100644 --- a/spec/unit/mutant/matcher_spec.rb +++ b/spec/unit/mutant/matcher_spec.rb @@ -3,7 +3,7 @@ RSpec.describe Mutant::Matcher do describe '.expand' do def apply - described_class.expand(env: env) + described_class.expand(env:) end let(:anon_matcher) { instance_double(Mutant::Matcher) } @@ -50,7 +50,7 @@ def apply ignore: ignore_expressions, subjects: [expression_a, expression_b], start_expressions: [], - diffs: diffs + diffs: ) end @@ -77,7 +77,7 @@ def apply end def expression(input, matcher = anon_matcher) - expression_class.new(child: parse_expression(input), matcher: matcher) + expression_class.new(child: parse_expression(input), matcher:) end context 'no restrictions of any kinds' do diff --git a/spec/unit/mutant/meta/example/dsl_spec.rb b/spec/unit/mutant/meta/example/dsl_spec.rb index 52cadae59..752f4c990 100644 --- a/spec/unit/mutant/meta/example/dsl_spec.rb +++ b/spec/unit/mutant/meta/example/dsl_spec.rb @@ -4,10 +4,10 @@ describe '.call' do subject do described_class.call( - block: block, - location: location, - operators: operators, - types: types + block:, + location:, + operators:, + types: ) end @@ -20,13 +20,13 @@ let(:expected_example) do Mutant::Meta::Example.new( - expected: expected, - location: location, - lvars: lvars, - node: node, - operators: operators, + expected:, + location:, + lvars:, + node:, + operators:, original_source: source, - types: types + types: ) end diff --git a/spec/unit/mutant/meta/example/verification_spec.rb b/spec/unit/mutant/meta/example/verification_spec.rb index d71901838..20ac8dbe2 100644 --- a/spec/unit/mutant/meta/example/verification_spec.rb +++ b/spec/unit/mutant/meta/example/verification_spec.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true RSpec.describe Mutant::Meta::Example::Verification do - let(:object) { described_class.new(example: example, mutations: mutations) } - let(:original_source) { 'true' } + let(:object) { described_class.new(example:, mutations:) } + let(:original_source) { 'true' } let(:location) do instance_double( @@ -14,19 +14,19 @@ let(:example) do Mutant::Meta::Example.new( - expected: expected, - location: location, + expected:, + location:, lvars: [], node: s(:true), operators: Mutant::Mutation::Operators::Full.new, - original_source: original_source, + original_source:, types: [:true] ) end let(:mutations) do generated_nodes.map do |node| - Mutant::Mutation::Evil.new(subject: example, node: node) + Mutant::Mutation::Evil.new(subject: example, node:) end end diff --git a/spec/unit/mutant/meta/example_spec.rb b/spec/unit/mutant/meta/example_spec.rb index 388b50b21..24fc1f7ef 100644 --- a/spec/unit/mutant/meta/example_spec.rb +++ b/spec/unit/mutant/meta/example_spec.rb @@ -4,9 +4,9 @@ let(:object) do described_class.new( expected: mutation_nodes, - location: location, + location:, lvars: [], - node: node, + node:, operators: Mutant::Mutation::Operators::Full.new, original_source: 'true', types: [node.type] @@ -26,7 +26,7 @@ let(:mutations) do mutation_nodes.map do |node| - Mutant::Mutation::Evil.new(subject: object, node: node) + Mutant::Mutation::Evil.new(subject: object, node:) end end @@ -47,7 +47,7 @@ describe '#verification' do subject { object.verification } - it { should eql(Mutant::Meta::Example::Verification.new(example: object, mutations: mutations)) } + it { should eql(Mutant::Meta::Example::Verification.new(example: object, mutations:)) } end let(:constant_scope) do @@ -64,7 +64,7 @@ ) end - it { should eql(Mutant::Context.new(constant_scope: constant_scope, scope: scope, source_path: location.path)) } + it { should eql(Mutant::Context.new(constant_scope:, scope:, source_path: location.path)) } end describe '#identification' do diff --git a/spec/unit/mutant/mutation/runner/sink_spec.rb b/spec/unit/mutant/mutation/runner/sink_spec.rb index 1b8a72df1..c1f690fc1 100644 --- a/spec/unit/mutant/mutation/runner/sink_spec.rb +++ b/spec/unit/mutant/mutation/runner/sink_spec.rb @@ -34,7 +34,7 @@ end end - let(:object) { described_class.new(env: env) } + let(:object) { described_class.new(env:) } describe '#response' do subject { object.response(mutation_a_index_response) } @@ -45,7 +45,7 @@ object.response(mutation_b_index_response) expect(object.status).to eql( Mutant::Result::Env.new( - env: env, + env:, runtime: 0.0, subject_results: [subject_a_result] ) @@ -70,7 +70,7 @@ context 'no results' do let(:expected_status) do Mutant::Result::Env.new( - env: env, + env:, runtime: 0.0, subject_results: [] ) @@ -86,7 +86,7 @@ let(:expected_status) do Mutant::Result::Env.new( - env: env, + env:, runtime: 0.0, subject_results: [subject_a_result] ) @@ -100,7 +100,7 @@ let(:expected_status) do Mutant::Result::Env.new( - env: env, + env:, runtime: 0.0, subject_results: [subject_a_result] ) diff --git a/spec/unit/mutant/mutation/runner_spec.rb b/spec/unit/mutant/mutation/runner_spec.rb index 610aec366..44cfc6524 100644 --- a/spec/unit/mutant/mutation/runner_spec.rb +++ b/spec/unit/mutant/mutation/runner_spec.rb @@ -7,16 +7,16 @@ let(:driver) { instance_double(Mutant::Parallel::Driver) } let(:emit_mutation_worker_process_start) { instance_double(Proc) } let(:env_result) { instance_double(Mutant::Result::Env) } - let(:reporter) { instance_double(Mutant::Reporter, delay: delay) } + let(:reporter) { instance_double(Mutant::Reporter, delay:) } let(:world) { instance_double(Mutant::World) } let(:timer) { instance_double(Mutant::Timer) } let(:env) do instance_double( Mutant::Env, - config: config, + config:, mutations: [instance_double(Mutant::Mutation)], - world: world + world: ) end @@ -24,7 +24,7 @@ instance_double( Mutant::Config, jobs: 1, - reporter: reporter + reporter: ) end @@ -45,11 +45,11 @@ let(:parallel_config) do Mutant::Parallel::Config.new( - block: block, + block:, jobs: 1, on_process_start: emit_mutation_worker_process_start, process_name: 'mutant-worker-process', - sink: described_class::Sink.new(env: env), + sink: described_class::Sink.new(env:), source: Mutant::Parallel::Source::Array.new(jobs: env.mutations.each_index.to_a), thread_name: 'mutant-worker-thread', timeout: nil @@ -57,7 +57,7 @@ end before do - allow(world).to receive_messages(timer: timer) + allow(world).to receive_messages(timer:) allow(world.timer).to receive_messages(now: 1.0) end @@ -94,7 +94,7 @@ def apply { receiver: Mutant::Parallel, selector: :async, - arguments: [{ world: world, config: parallel_config }], + arguments: [{ world:, config: parallel_config }], reaction: { return: driver } }, { @@ -171,7 +171,7 @@ def apply { receiver: Mutant::Parallel, selector: :async, - arguments: [{ world: world, config: parallel_config }], + arguments: [{ world:, config: parallel_config }], reaction: { return: driver } }, { diff --git a/spec/unit/mutant/mutation_spec.rb b/spec/unit/mutant/mutation_spec.rb index 2bcb59629..5125b48b8 100644 --- a/spec/unit/mutant/mutation_spec.rb +++ b/spec/unit/mutant/mutation_spec.rb @@ -14,14 +14,14 @@ let(:root_node) { s(:int, 1) } let(:object) do - mutation_class.new(subject: mutation_subject, node: node) + mutation_class.new(subject: mutation_subject, node:) end let(:mutation_subject) do instance_double( Mutant::Subject, identification: 'subject', - context: context, + context:, source: 'original' ) end @@ -76,7 +76,7 @@ def apply .ordered .with( binding: TOPLEVEL_BINDING, - kernel: kernel, + kernel:, source: expected_source, subject: mutation_subject ) @@ -101,7 +101,7 @@ def apply .ordered .with( binding: TOPLEVEL_BINDING, - kernel: kernel, + kernel:, source: expected_source, subject: mutation_subject ) @@ -145,7 +145,7 @@ def apply let(:test_result) do instance_double( Mutant::Result::Test, - passed: passed + passed: ) end diff --git a/spec/unit/mutant/mutator/node_spec.rb b/spec/unit/mutant/mutator/node_spec.rb index eedd14552..4827363c3 100644 --- a/spec/unit/mutant/mutator/node_spec.rb +++ b/spec/unit/mutant/mutator/node_spec.rb @@ -82,8 +82,8 @@ def apply describe '.mutate', mutant_expression: 'Mutant::Mutator::Node*' do def apply described_class.mutate( - config: config, - node: node + config:, + node: ) end diff --git a/spec/unit/mutant/parallel/connection/reader_spec.rb b/spec/unit/mutant/parallel/connection/reader_spec.rb index df4faaa62..556de0baa 100644 --- a/spec/unit/mutant/parallel/connection/reader_spec.rb +++ b/spec/unit/mutant/parallel/connection/reader_spec.rb @@ -14,12 +14,12 @@ describe '.read_response' do def apply described_class.read_response( - deadline: deadline, - io: io, - job: job, - log_reader: log_reader, - marshal: marshal, - response_reader: response_reader + deadline:, + io:, + job:, + log_reader:, + marshal:, + response_reader: ) end @@ -52,7 +52,7 @@ def deadline_status(time_left: 1.0) { receiver: deadline, selector: :status, - reaction: { return: Mutant::Timer::Deadline::Status.new(time_left: time_left) } + reaction: { return: Mutant::Timer::Deadline::Status.new(time_left:) } } end @@ -92,9 +92,9 @@ def marshal_load expect(apply).to eql( Mutant::Parallel::Response.new( error: nil, - job: job, + job:, log: '', - result: result + result: ) ) end @@ -124,9 +124,9 @@ def marshal_load expect(apply).to eql( Mutant::Parallel::Response.new( error: nil, - job: job, + job:, log: '', - result: result + result: ) ) end @@ -161,9 +161,9 @@ def marshal_load expect(apply).to eql( Mutant::Parallel::Response.new( error: nil, - job: job, + job:, log: '', - result: result + result: ) ) end @@ -192,7 +192,7 @@ def marshal_load expect(apply).to eql( Mutant::Parallel::Response.new( error: Timeout::Error, - job: job, + job:, log: '', result: nil ) @@ -220,7 +220,7 @@ def marshal_load expect(apply).to eql( Mutant::Parallel::Response.new( error: EOFError, - job: job, + job:, log: '', result: nil ) @@ -242,7 +242,7 @@ def marshal_load expect(apply).to eql( Mutant::Parallel::Response.new( error: Timeout::Error, - job: job, + job:, log: '', result: nil ) @@ -263,7 +263,7 @@ def marshal_load expect(apply).to eql( Mutant::Parallel::Response.new( error: Timeout::Error, - job: job, + job:, log: '', result: nil ) diff --git a/spec/unit/mutant/parallel/connection_spec.rb b/spec/unit/mutant/parallel/connection_spec.rb index 2993331b2..d876bfa35 100644 --- a/spec/unit/mutant/parallel/connection_spec.rb +++ b/spec/unit/mutant/parallel/connection_spec.rb @@ -25,7 +25,7 @@ let(:object) do described_class.from_pipes( - marshal: marshal, + marshal:, reader: pipe_a, writer: pipe_b ) @@ -195,7 +195,7 @@ def apply it 'returns expected connection' do expect(object).to eql( described_class.new( - marshal: marshal, + marshal:, reader: described_class::Frame.new(io: pipe_a.to_reader), writer: described_class::Frame.new(io: pipe_b.to_writer) ) diff --git a/spec/unit/mutant/parallel/driver_spec.rb b/spec/unit/mutant/parallel/driver_spec.rb index 1c6143843..31a019589 100644 --- a/spec/unit/mutant/parallel/driver_spec.rb +++ b/spec/unit/mutant/parallel/driver_spec.rb @@ -25,13 +25,13 @@ subject do described_class.new( - threads: threads, - var_active_jobs: var_active_jobs, - var_final: var_final, - var_running: var_running, - var_sink: var_sink, - var_source: var_source, - workers: workers + threads:, + var_active_jobs:, + var_final:, + var_running:, + var_sink:, + var_source:, + workers: ) end @@ -122,7 +122,7 @@ def apply let(:expected_status) do Mutant::Parallel::Status.new( - active_jobs: active_jobs, + active_jobs:, done: true, payload: sink_status ) @@ -189,7 +189,7 @@ def apply context 'when not done' do let(:expected_status) do Mutant::Parallel::Status.new( - active_jobs: active_jobs, + active_jobs:, done: false, payload: sink_status ) diff --git a/spec/unit/mutant/parallel/pipe_spec.rb b/spec/unit/mutant/parallel/pipe_spec.rb index 4a31fa9c4..8556c8d4e 100644 --- a/spec/unit/mutant/parallel/pipe_spec.rb +++ b/spec/unit/mutant/parallel/pipe_spec.rb @@ -5,7 +5,7 @@ let(:reader) { instance_double(IO, :a) } let(:writer) { instance_double(IO, :a) } - subject { described_class.new(reader: reader, writer: writer) } + subject { described_class.new(reader:, writer:) } describe '.from_io' do def apply @@ -25,7 +25,7 @@ def apply it 'returns expected pipe' do verify_events do - expect(apply).to eql(described_class.new(reader: reader, writer: writer)) + expect(apply).to eql(described_class.new(reader:, writer:)) end end end diff --git a/spec/unit/mutant/parallel/source/array_spec.rb b/spec/unit/mutant/parallel/source/array_spec.rb index 55bb6008f..0a0b2b68c 100644 --- a/spec/unit/mutant/parallel/source/array_spec.rb +++ b/spec/unit/mutant/parallel/source/array_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe Mutant::Parallel::Source::Array do - subject { described_class.new(jobs: jobs) } + subject { described_class.new(jobs:) } let(:jobs) { %i[a b c] } diff --git a/spec/unit/mutant/parallel/worker_spec.rb b/spec/unit/mutant/parallel/worker_spec.rb index f95a3aec7..11f41d391 100644 --- a/spec/unit/mutant/parallel/worker_spec.rb +++ b/spec/unit/mutant/parallel/worker_spec.rb @@ -60,11 +60,11 @@ def pipe(name) let(:shared) do { - var_active_jobs: var_active_jobs, - var_final: var_final, - var_running: var_running, - var_sink: var_sink, - var_source: var_source + var_active_jobs:, + var_final:, + var_running:, + var_sink:, + var_source: } end @@ -73,14 +73,14 @@ def pipe(name) connection: parent_connection, log_reader: log_pipe.to_reader, response_reader: response_pipe.to_reader, - pid: pid, + pid:, config: described_class::Config.new( - block: block, - index: index, - on_process_start: on_process_start, - process_name: process_name, + block:, + index:, + on_process_start:, + process_name:, timeout: 1.0, - world: world, + world:, **shared ) ) @@ -214,9 +214,9 @@ def read_response(job, response) receiver: Mutant::Parallel::Connection::Reader, arguments: [ { - deadline: deadline, + deadline:, io: world.io, - job: job, + job:, log_reader: log_pipe.to_reader, marshal: world.marshal, response_reader: response_pipe.to_reader @@ -421,17 +421,17 @@ def apply # rubocop:disable Metrics/MethodLength def apply described_class.start( - block: block, - index: index, - on_process_start: on_process_start, - process_name: process_name, + block:, + index:, + on_process_start:, + process_name:, timeout: 1.0, - var_active_jobs: var_active_jobs, - var_final: var_final, - var_running: var_running, - var_sink: var_sink, - var_source: var_source, - world: world + var_active_jobs:, + var_final:, + var_running:, + var_sink:, + var_source:, + world: ) end # rubocop:enable Metrics/MethodLength @@ -495,7 +495,7 @@ def apply { receiver: on_process_start, selector: :call, - arguments: [{ index: index }] + arguments: [{ index: }] }, { receiver: child_connection, diff --git a/spec/unit/mutant/parallel_spec.rb b/spec/unit/mutant/parallel_spec.rb index f1771f132..7e9ad8a35 100644 --- a/spec/unit/mutant/parallel_spec.rb +++ b/spec/unit/mutant/parallel_spec.rb @@ -3,7 +3,7 @@ RSpec.describe Mutant::Parallel do describe '.async' do def apply - described_class.async(config: config, world: world) + described_class.async(config:, world:) end let(:block) { instance_double(Proc) } @@ -38,12 +38,12 @@ def apply let(:config) do Mutant::Parallel::Config.new( - block: block, - jobs: jobs, - on_process_start: on_process_start, + block:, + jobs:, + on_process_start:, process_name: 'parallel-process', - sink: sink, - source: source, + sink:, + source:, thread_name: 'parallel-thread', timeout: 1.0 ) @@ -72,17 +72,17 @@ def worker(index, name, worker) receiver: Mutant::Parallel::Worker, selector: :start, arguments: [ - block: block, - index: index, + block:, + index:, on_process_start: config.on_process_start, process_name: name, timeout: 1.0, - var_active_jobs: var_active_jobs, - var_final: var_final, - var_running: var_running, - var_sink: var_sink, - var_source: var_source, - world: world + var_active_jobs:, + var_final:, + var_running:, + var_sink:, + var_source:, + world: ], reaction: { return: worker } } @@ -136,11 +136,11 @@ def thread(name, thread, worker) expect(apply).to eql( described_class::Driver.new( threads: [thread_a, thread_b], - var_active_jobs: var_active_jobs, - var_final: var_final, - var_running: var_running, - var_sink: var_sink, - var_source: var_source, + var_active_jobs:, + var_final:, + var_running:, + var_sink:, + var_source:, workers: [worker_a, worker_b] ) ) diff --git a/spec/unit/mutant/procto_spec.rb b/spec/unit/mutant/procto_spec.rb index 72d1a1824..d26860745 100644 --- a/spec/unit/mutant/procto_spec.rb +++ b/spec/unit/mutant/procto_spec.rb @@ -14,6 +14,6 @@ def call it 'creates a .call that proxies to #call' do argument = +'foo' - expect(klass.call(argument: argument)).to be(argument) + expect(klass.call(argument:)).to be(argument) end end diff --git a/spec/unit/mutant/reporter/cli/printer/isolation_result_spec.rb b/spec/unit/mutant/reporter/cli/printer/isolation_result_spec.rb index 0f7637c05..3b1635549 100644 --- a/spec/unit/mutant/reporter/cli/printer/isolation_result_spec.rb +++ b/spec/unit/mutant/reporter/cli/printer/isolation_result_spec.rb @@ -11,11 +11,11 @@ let(:reportable) do Mutant::Isolation::Result.new( - exception: exception, - log: log, - process_status: process_status, - timeout: timeout, - value: value + exception:, + log:, + process_status:, + timeout:, + value: ) end diff --git a/spec/unit/mutant/reporter/cli/printer/mutation_result_spec.rb b/spec/unit/mutant/reporter/cli/printer/mutation_result_spec.rb index 4764fb02d..b87703a0a 100644 --- a/spec/unit/mutant/reporter/cli/printer/mutation_result_spec.rb +++ b/spec/unit/mutant/reporter/cli/printer/mutation_result_spec.rb @@ -13,7 +13,7 @@ with(:mutation_a_result) do { - isolation_result: mutation_a_isolation_result.with(process_status: process_status) + isolation_result: mutation_a_isolation_result.with(process_status:) } end diff --git a/spec/unit/mutant/reporter/cli/printer/test/env_result_spec.rb b/spec/unit/mutant/reporter/cli/printer/test/env_result_spec.rb index 7eb55cbd6..08716597d 100644 --- a/spec/unit/mutant/reporter/cli/printer/test/env_result_spec.rb +++ b/spec/unit/mutant/reporter/cli/printer/test/env_result_spec.rb @@ -5,7 +5,7 @@ let(:reportable) do Mutant::Result::TestEnv.new( - env: env, + env:, runtime: 0.8, test_results: [test_result_a, test_result_b] ) diff --git a/spec/unit/mutant/reporter/cli/printer/test/status_progressive_spec.rb b/spec/unit/mutant/reporter/cli/printer/test/status_progressive_spec.rb index 99ae5a11d..2b7a66261 100644 --- a/spec/unit/mutant/reporter/cli/printer/test/status_progressive_spec.rb +++ b/spec/unit/mutant/reporter/cli/printer/test/status_progressive_spec.rb @@ -8,9 +8,9 @@ let(:test_env) do Mutant::Result::TestEnv.new( - env: env, + env:, runtime: 0.8, - test_results: test_results + test_results: ) end diff --git a/spec/unit/mutant/reporter/cli/printer_spec.rb b/spec/unit/mutant/reporter/cli/printer_spec.rb index 788a5567d..17c8d6dd2 100644 --- a/spec/unit/mutant/reporter/cli/printer_spec.rb +++ b/spec/unit/mutant/reporter/cli/printer_spec.rb @@ -3,7 +3,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer do let(:output) { StringIO.new } - subject { class_under_test.call(output: output, object: reportable) } + subject { class_under_test.call(output:, object: reportable) } def self.it_reports(expectation) it 'writes expected report' do diff --git a/spec/unit/mutant/reporter/cli_spec.rb b/spec/unit/mutant/reporter/cli_spec.rb index 7368d813c..0c9d126ec 100644 --- a/spec/unit/mutant/reporter/cli_spec.rb +++ b/spec/unit/mutant/reporter/cli_spec.rb @@ -3,9 +3,9 @@ RSpec.describe Mutant::Reporter::CLI do setup_shared_context - let(:format) { described_class::Format::Progressive.new(tty: tty?) } - let(:object) { described_class.new(format: format, output: output, print_warnings: false) } - let(:tty?) { false } + let(:format) { described_class::Format::Progressive.new(tty: tty?) } + let(:object) { described_class.new(format:, output:, print_warnings: false) } + let(:tty?) { false } def contents output.rewind @@ -26,18 +26,18 @@ def self.it_reports(expected_content) let(:tty?) { true } let(:output) { instance_double(IO, tty?: true) } - it { should eql(described_class.new(format: format, output: output, print_warnings: false)) } + it { should eql(described_class.new(format:, output:, print_warnings: false)) } end context 'when output is not a tty' do context 'and does not respond to #tty?' do let(:output) { nil } - it { should eql(described_class.new(format: format, output: output, print_warnings: false)) } + it { should eql(described_class.new(format:, output:, print_warnings: false)) } end context 'and does respond to #tty?' do - it { should eql(described_class.new(format: format, output: output, print_warnings: false)) } + it { should eql(described_class.new(format:, output:, print_warnings: false)) } end end end @@ -164,7 +164,7 @@ def self.it_reports(expected_content) let(:test_env) do Mutant::Result::TestEnv.new( - env: env, + env:, runtime: 1.0, test_results: [] ) @@ -190,7 +190,7 @@ def self.it_reports(expected_content) let(:test_env) do Mutant::Result::TestEnv.new( - env: env, + env:, runtime: 1.0, test_results: [] ) diff --git a/spec/unit/mutant/repository/diff_spec.rb b/spec/unit/mutant/repository/diff_spec.rb index 5f201b9cf..dd2f242d0 100644 --- a/spec/unit/mutant/repository/diff_spec.rb +++ b/spec/unit/mutant/repository/diff_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true describe Mutant::Repository::Diff do - subject { described_class.new(world: world, to: 'to_rev') } + subject { described_class.new(world:, to: 'to_rev') } let(:kernel) { class_double(Kernel) } let(:line_range) { 4..5 } @@ -11,8 +11,8 @@ let(:world) do instance_double( Mutant::World, - kernel: kernel, - pathname: pathname + kernel:, + pathname: ) end @@ -20,7 +20,7 @@ def mk_command_status_result(stdout) right( instance_double( Mutant::World::CommandStatus, - stdout: stdout + stdout: ) ) end diff --git a/spec/unit/mutant/result/coverage_criteria_spec.rb b/spec/unit/mutant/result/coverage_criteria_spec.rb index c8a2fe373..7e5c32286 100644 --- a/spec/unit/mutant/result/coverage_criteria_spec.rb +++ b/spec/unit/mutant/result/coverage_criteria_spec.rb @@ -3,9 +3,9 @@ RSpec.describe Mutant::Result::CoverageCriteria do let(:object) do described_class.new( - process_abort: process_abort, - test_result: test_result, - timeout: timeout + process_abort:, + test_result:, + timeout: ) end diff --git a/spec/unit/mutant/result/env_spec.rb b/spec/unit/mutant/result/env_spec.rb index 970c527fb..94b91ba07 100644 --- a/spec/unit/mutant/result/env_spec.rb +++ b/spec/unit/mutant/result/env_spec.rb @@ -4,8 +4,8 @@ let(:object) do described_class.new( runtime: instance_double(Float), - env: env, - subject_results: subject_results + env:, + subject_results: ) end @@ -14,10 +14,10 @@ let(:env) do instance_double( Mutant::Env, - config: instance_double(Mutant::Config, fail_fast: fail_fast), - integration: integration, + config: instance_double(Mutant::Config, fail_fast:), + integration:, mutations: [instance_double(Mutant::Mutation)], - selections: selections, + selections:, subjects: [subject_a, subject_b] ) end diff --git a/spec/unit/mutant/result/mutation_spec.rb b/spec/unit/mutant/result/mutation_spec.rb index 8c39bf44a..c421837f3 100644 --- a/spec/unit/mutant/result/mutation_spec.rb +++ b/spec/unit/mutant/result/mutation_spec.rb @@ -3,8 +3,8 @@ RSpec.describe Mutant::Result::Mutation do let(:object) do described_class.new( - isolation_result: isolation_result, - mutation: mutation, + isolation_result:, + mutation:, runtime: 2.0 ) end @@ -30,7 +30,7 @@ Mutant::Isolation::Result.new( exception: nil, log: '', - process_status: process_status, + process_status:, timeout: nil, value: test_result ) diff --git a/spec/unit/mutant/result/subject_spec.rb b/spec/unit/mutant/result/subject_spec.rb index 7160b81c2..6efbd5192 100644 --- a/spec/unit/mutant/result/subject_spec.rb +++ b/spec/unit/mutant/result/subject_spec.rb @@ -4,7 +4,7 @@ let(:object) do described_class.new( subject: mutation_subject, - coverage_results: coverage_results, + coverage_results:, tests: [] ) end diff --git a/spec/unit/mutant/result/test_env_spec.rb b/spec/unit/mutant/result/test_env_spec.rb index aabbea3d8..bd452a7a7 100644 --- a/spec/unit/mutant/result/test_env_spec.rb +++ b/spec/unit/mutant/result/test_env_spec.rb @@ -4,16 +4,16 @@ let(:object) do described_class.new( runtime: instance_double(Float), - env: env, - test_results: test_results + env:, + test_results: ) end let(:env) do instance_double( Mutant::Env, - config: instance_double(Mutant::Config, fail_fast: fail_fast), - integration: integration + config: instance_double(Mutant::Config, fail_fast:), + integration: ) end diff --git a/spec/unit/mutant/segment/recorder_spec.rb b/spec/unit/mutant/segment/recorder_spec.rb index 29b0f694e..15358b2f2 100644 --- a/spec/unit/mutant/segment/recorder_spec.rb +++ b/spec/unit/mutant/segment/recorder_spec.rb @@ -3,12 +3,12 @@ RSpec.describe Mutant::Segment::Recorder do subject do described_class.new( - gen_id: gen_id, + gen_id:, parent_id: root_segment.id, recording_start: 0.5, root_id: root_segment.id, segments: [root_segment], - timer: timer + timer: ) end diff --git a/spec/unit/mutant/selector/expression_spec.rb b/spec/unit/mutant/selector/expression_spec.rb index 4ee1c7678..42010d86f 100644 --- a/spec/unit/mutant/selector/expression_spec.rb +++ b/spec/unit/mutant/selector/expression_spec.rb @@ -2,7 +2,7 @@ RSpec.describe Mutant::Selector::Expression do describe '#call' do - let(:object) { described_class.new(integration: integration) } + let(:object) { described_class.new(integration:) } let(:context) { instance_double(Mutant::Context) } let(:node) { instance_double(Parser::AST::Node) } @@ -14,15 +14,15 @@ let(:integration) do instance_double( Mutant::Integration, - available_tests: available_tests + available_tests: ) end let(:mutation_subject) do subject_class.new( config: Mutant::Subject::Config::DEFAULT, - context: context, - node: node + context:, + node: ) end diff --git a/spec/unit/mutant/subject/config_spec.rb b/spec/unit/mutant/subject/config_spec.rb index 4cf1b3099..4100214ab 100644 --- a/spec/unit/mutant/subject/config_spec.rb +++ b/spec/unit/mutant/subject/config_spec.rb @@ -4,7 +4,7 @@ describe '.parse' do def apply described_class.parse( - comments: comments, + comments:, mutation: mutation_config ) end diff --git a/spec/unit/mutant/subject/method/instance_spec.rb b/spec/unit/mutant/subject/method/instance_spec.rb index a6576d4ff..e8cc903da 100644 --- a/spec/unit/mutant/subject/method/instance_spec.rb +++ b/spec/unit/mutant/subject/method/instance_spec.rb @@ -4,8 +4,8 @@ let(:object) do described_class.new( config: Mutant::Subject::Config::DEFAULT, - context: context, - node: node, + context:, + node:, visibility: :private ) end @@ -18,8 +18,8 @@ let(:context) do Mutant::Context.new( - constant_scope: constant_scope, - scope: scope, + constant_scope:, + scope:, source_path: instance_double(Pathname) ) end @@ -96,8 +96,8 @@ def self.name let(:object) do described_class.new( config: Mutant::Subject::Config::DEFAULT, - context: context, - node: node, + context:, + node:, visibility: :public ) end @@ -108,8 +108,8 @@ def self.name let(:context) do Mutant::Context.new( - constant_scope: constant_scope, - scope: scope, + constant_scope:, + scope:, source_path: instance_double(Pathname) ) end diff --git a/spec/unit/mutant/subject/method/metaclass_spec.rb b/spec/unit/mutant/subject/method/metaclass_spec.rb index 56a9ab72d..1ed8d0470 100644 --- a/spec/unit/mutant/subject/method/metaclass_spec.rb +++ b/spec/unit/mutant/subject/method/metaclass_spec.rb @@ -4,8 +4,8 @@ let(:object) do described_class.new( config: Mutant::Subject::Config::DEFAULT, - context: context, - node: node, + context:, + node:, visibility: :public ) end @@ -18,8 +18,8 @@ let(:context) do Mutant::Context.new( - constant_scope: constant_scope, - scope: scope, + constant_scope:, + scope:, source_path: instance_double(Pathname) ) end diff --git a/spec/unit/mutant/subject/method/singleton_spec.rb b/spec/unit/mutant/subject/method/singleton_spec.rb index b879bac2c..2ae08f6ca 100644 --- a/spec/unit/mutant/subject/method/singleton_spec.rb +++ b/spec/unit/mutant/subject/method/singleton_spec.rb @@ -4,8 +4,8 @@ let(:object) do described_class.new( config: Mutant::Subject::Config::DEFAULT, - context: context, - node: node, + context:, + node:, visibility: :private ) end @@ -17,7 +17,7 @@ end let(:context) do - Mutant::Context.new(constant_scope: constant_scope, scope: scope, source_path: instance_double(Pathname)) + Mutant::Context.new(constant_scope:, scope:, source_path: instance_double(Pathname)) end let(:scope) do diff --git a/spec/unit/mutant/subject_spec.rb b/spec/unit/mutant/subject_spec.rb index f47cf77cc..70469029f 100644 --- a/spec/unit/mutant/subject_spec.rb +++ b/spec/unit/mutant/subject_spec.rb @@ -19,8 +19,8 @@ def match_expressions let(:object) do class_under_test.new( config: Mutant::Subject::Config::DEFAULT, - context: context, - node: node + context:, + node: ) end @@ -90,7 +90,7 @@ def foo .to receive(:mutate) .with( config: Mutant::Mutation::Config::DEFAULT, - node: node + node: ) .and_return([mutation_a, mutation_b]) end @@ -100,7 +100,7 @@ def foo it 'generates neutral and evil mutations' do should eql([ - Mutant::Mutation::Neutral.new(subject: object, node: node), + Mutant::Mutation::Neutral.new(subject: object, node:), Mutant::Mutation::Evil.new(subject: object, node: mutation_a), Mutant::Mutation::Evil.new(subject: object, node: mutation_b) ]) diff --git a/spec/unit/mutant/test/runner/sink_spec.rb b/spec/unit/mutant/test/runner/sink_spec.rb index f12dcf7e0..e8fa52715 100644 --- a/spec/unit/mutant/test/runner/sink_spec.rb +++ b/spec/unit/mutant/test/runner/sink_spec.rb @@ -1,17 +1,17 @@ # frozen_string_literal: true describe Mutant::Test::Runner::Sink do - let(:object) { described_class.new(env: env) } - let(:fail_fast) { false } + let(:object) { described_class.new(env:) } + let(:fail_fast) { false } let(:env) do instance_double( Mutant::Env, - config: config, + config:, world: instance_double( Mutant::World, - timer: timer, - stderr: stderr + timer:, + stderr: ) ) end @@ -21,7 +21,7 @@ end let(:config) do - instance_double(Mutant::Config, fail_fast: fail_fast) + instance_double(Mutant::Config, fail_fast:) end let(:timer) do @@ -107,7 +107,7 @@ object.response(test_response_b) expect(object.status).to eql( Mutant::Result::TestEnv.new( - env: env, + env:, runtime: 1.5, test_results: [test_result_a, test_result_b] ) @@ -149,7 +149,7 @@ context 'no results' do let(:expected_status) do Mutant::Result::TestEnv.new( - env: env, + env:, runtime: 1.5, test_results: [] ) @@ -163,7 +163,7 @@ let(:expected_status) do Mutant::Result::TestEnv.new( - env: env, + env:, runtime: 1.5, test_results: [test_result_a] ) @@ -177,7 +177,7 @@ let(:expected_status) do Mutant::Result::TestEnv.new( - env: env, + env:, runtime: 1.5, test_results: [test_result_a, test_result_b] ) @@ -194,7 +194,7 @@ let(:expected_status) do Mutant::Result::TestEnv.new( - env: env, + env:, runtime: 1.5, test_results: [test_result_a, test_result_b] ) diff --git a/spec/unit/mutant/test/runner_spec.rb b/spec/unit/mutant/test/runner_spec.rb index e35124e48..4f72594c0 100644 --- a/spec/unit/mutant/test/runner_spec.rb +++ b/spec/unit/mutant/test/runner_spec.rb @@ -6,25 +6,25 @@ let(:delay) { instance_double(Float) } let(:driver) { instance_double(Mutant::Parallel::Driver) } let(:emit_test_worker_process_start) { instance_double(Proc) } - let(:env_result) { instance_double(Mutant::Result::Env) } - let(:reporter) { instance_double(Mutant::Reporter, delay: delay) } + let(:env_result) { instance_double(Mutant::Result::Env) } + let(:reporter) { instance_double(Mutant::Reporter, delay:) } let(:timer) { instance_double(Mutant::Timer) } let(:world) { instance_double(Mutant::World) } let(:env) do instance_double( Mutant::Env, - config: config, - integration: integration, + config:, + integration:, mutations: [instance_double(Mutant::Mutation)], - world: world + world: ) end let(:integration) do instance_double( Mutant::Integration, - all_tests: all_tests + all_tests: ) end @@ -39,7 +39,7 @@ instance_double( Mutant::Config, jobs: 1, - reporter: reporter + reporter: ) end @@ -60,11 +60,11 @@ let(:parallel_config) do Mutant::Parallel::Config.new( - block: block, + block:, jobs: 1, on_process_start: emit_test_worker_process_start, process_name: 'mutant-test-runner-process', - sink: described_class::Sink.new(env: env), + sink: described_class::Sink.new(env:), source: Mutant::Parallel::Source::Array.new(jobs: all_tests.each_index.to_a), thread_name: 'mutant-test-runner-thread', timeout: nil @@ -72,7 +72,7 @@ end before do - allow(world).to receive_messages(timer: timer) + allow(world).to receive_messages(timer:) allow(world.timer).to receive_messages(now: 1.0) end @@ -109,7 +109,7 @@ def apply { receiver: Mutant::Parallel, selector: :async, - arguments: [{ world: world, config: parallel_config }], + arguments: [{ world:, config: parallel_config }], reaction: { return: driver } }, { @@ -186,7 +186,7 @@ def apply { receiver: Mutant::Parallel, selector: :async, - arguments: [{ world: world, config: parallel_config }], + arguments: [{ world:, config: parallel_config }], reaction: { return: driver } }, { diff --git a/spec/unit/mutant/timer/deadline_spec.rb b/spec/unit/mutant/timer/deadline_spec.rb index 42c50f569..9e245807f 100644 --- a/spec/unit/mutant/timer/deadline_spec.rb +++ b/spec/unit/mutant/timer/deadline_spec.rb @@ -3,8 +3,8 @@ RSpec.describe Mutant::Timer::Deadline do let(:object) do described_class.new( - timer: timer, - allowed_time: allowed_time + timer:, + allowed_time: ) end @@ -96,7 +96,7 @@ def apply end RSpec.describe Mutant::Timer::Deadline::Status do - let(:object) { described_class.new(time_left: time_left) } + let(:object) { described_class.new(time_left:) } describe '#ok?' do def apply diff --git a/spec/unit/mutant/timer_spec.rb b/spec/unit/mutant/timer_spec.rb index 241885965..b5413c720 100644 --- a/spec/unit/mutant/timer_spec.rb +++ b/spec/unit/mutant/timer_spec.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true RSpec.describe Mutant::Timer do - let(:events) { [] } - let(:object) { described_class.new(process: process) } + let(:events) { [] } + let(:object) { described_class.new(process:) } let(:process) { class_double(Process) } let(:times) { [0.5, 2.0] } diff --git a/spec/unit/mutant/transform/array_spec.rb b/spec/unit/mutant/transform/array_spec.rb index 5550bde03..057bae505 100644 --- a/spec/unit/mutant/transform/array_spec.rb +++ b/spec/unit/mutant/transform/array_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe Mutant::Transform::Array do - subject { described_class.new(transform: transform) } + subject { described_class.new(transform:) } let(:transform) { Mutant::Transform::Boolean.new } @@ -35,7 +35,7 @@ def apply cause: nil, input: 1, message: 'Expected: boolean but got: 1', - transform: transform + transform: ) end @@ -44,14 +44,14 @@ def apply cause: boolean_error, input: 1, message: nil, - transform: Mutant::Transform::Index.new(index: 1, transform: transform) + transform: Mutant::Transform::Index.new(index: 1, transform:) ) end let(:error) do Mutant::Transform::Error.new( cause: index_error, - input: input, + input:, message: 'Failed to coerce array at index: 1', transform: subject ) @@ -78,7 +78,7 @@ def apply let(:error) do Mutant::Transform::Error.new( cause: nil, - input: input, + input:, message: 'Expected: Array but got: FalseClass', transform: subject ) diff --git a/spec/unit/mutant/transform/block_spec.rb b/spec/unit/mutant/transform/block_spec.rb index b3895457f..ad8586496 100644 --- a/spec/unit/mutant/transform/block_spec.rb +++ b/spec/unit/mutant/transform/block_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe Mutant::Transform::Block do - subject { described_class.new(name: name, block: block) } + subject { described_class.new(name:, block:) } let(:block) { ->(value) { right(value * 2) } } let(:name) { :external } @@ -27,7 +27,7 @@ def apply left( Mutant::Transform::Error.new( cause: nil, - input: input, + input:, message: 'some error', transform: subject ) @@ -53,7 +53,7 @@ def apply end it 'returns expected transform' do - expect(apply).to eql(described_class.new(name: name, block: block)) + expect(apply).to eql(described_class.new(name:, block:)) end end end diff --git a/spec/unit/mutant/transform/bool_spec.rb b/spec/unit/mutant/transform/bool_spec.rb index 241912d66..ebb642e27 100644 --- a/spec/unit/mutant/transform/bool_spec.rb +++ b/spec/unit/mutant/transform/bool_spec.rb @@ -30,7 +30,7 @@ def apply let(:error) do Mutant::Transform::Error.new( cause: nil, - input: input, + input:, message: 'Expected: boolean but got: nil', transform: subject ) @@ -47,7 +47,7 @@ def apply let(:error) do Mutant::Transform::Error.new( cause: nil, - input: input, + input:, message: 'Expected: boolean but got: ""', transform: subject ) diff --git a/spec/unit/mutant/transform/error_spec.rb b/spec/unit/mutant/transform/error_spec.rb index 3b1533828..0ca249ff4 100644 --- a/spec/unit/mutant/transform/error_spec.rb +++ b/spec/unit/mutant/transform/error_spec.rb @@ -18,8 +18,8 @@ { cause: direct_cause, input: nil, - message: message, - transform: transform + message:, + transform: } end @@ -36,7 +36,7 @@ cause: indirect_cause, input: nil, message: 'direct-cause-message', - transform: transform + transform: ) end end diff --git a/spec/unit/mutant/transform/exception_spec.rb b/spec/unit/mutant/transform/exception_spec.rb index 4b9c21a1f..3226b9460 100644 --- a/spec/unit/mutant/transform/exception_spec.rb +++ b/spec/unit/mutant/transform/exception_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe Mutant::Transform::Exception do - subject { described_class.new(error_class: error_class, block: block) } + subject { described_class.new(error_class:, block:) } let(:error_class) do Class.new(RuntimeError) @@ -29,7 +29,7 @@ def apply let(:error) do Mutant::Transform::Error.new( cause: nil, - input: input, + input:, message: 'some message', transform: subject ) diff --git a/spec/unit/mutant/transform/hash_spec.rb b/spec/unit/mutant/transform/hash_spec.rb index a6fc8fe19..e497fa0e7 100644 --- a/spec/unit/mutant/transform/hash_spec.rb +++ b/spec/unit/mutant/transform/hash_spec.rb @@ -9,8 +9,8 @@ let(:attributes) do { - required: required, - optional: optional + required:, + optional: } end @@ -35,7 +35,7 @@ def apply let(:error) do Mutant::Transform::Error.new( cause: nil, - input: input, + input:, message: 'Missing keys: [:foo], Unexpected keys: []', transform: subject ) @@ -52,7 +52,7 @@ def apply let(:error) do Mutant::Transform::Error.new( cause: nil, - input: input, + input:, message: 'Missing keys: [], Unexpected keys: [:foo]', transform: subject ) @@ -114,7 +114,7 @@ def apply let(:error) do Mutant::Transform::Error.new( cause: inner_error, - input: input, + input:, message: nil, transform: subject ) @@ -150,7 +150,7 @@ def apply let(:error) do Mutant::Transform::Error.new( cause: nil, - input: input, + input:, message: 'Expected: Hash but got: Array', transform: subject ) diff --git a/spec/unit/mutant/transform/index_spec.rb b/spec/unit/mutant/transform/index_spec.rb index 9db965939..868d877af 100644 --- a/spec/unit/mutant/transform/index_spec.rb +++ b/spec/unit/mutant/transform/index_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe Mutant::Transform::Index do - subject { described_class.new(index: index, transform: transform) } + subject { described_class.new(index:, transform:) } let(:index) { 1 } let(:transform) { Mutant::Transform::Boolean.new } @@ -43,16 +43,16 @@ def apply let(:boolean_error) do Mutant::Transform::Error.new( cause: nil, - input: input, + input:, message: 'Expected: boolean but got: 1', - transform: transform + transform: ) end let(:error) do Mutant::Transform::Error.new( cause: boolean_error, - input: input, + input:, message: nil, transform: subject ) @@ -74,7 +74,7 @@ def apply cause: :nil, input: 1, message: nil, - transform: transform + transform: ) end @@ -84,7 +84,7 @@ def apply cause: error, input: 1, message: nil, - transform: described_class.new(index: index, transform: transform) + transform: described_class.new(index:, transform:) ) ) end diff --git a/spec/unit/mutant/transform/named_spec.rb b/spec/unit/mutant/transform/named_spec.rb index eed050605..9ff8b1ad5 100644 --- a/spec/unit/mutant/transform/named_spec.rb +++ b/spec/unit/mutant/transform/named_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe Mutant::Transform::Named do - subject { described_class.new(name: name, transform: transform) } + subject { described_class.new(name:, transform:) } let(:name) { 'transform-name' } let(:transform) { Mutant::Transform::Boolean.new } @@ -35,7 +35,7 @@ def apply let(:error) do Mutant::Transform::Error.new( cause: transform.call(input).from_left, - input: input, + input:, message: nil, transform: subject ) diff --git a/spec/unit/mutant/transform/primitive_spec.rb b/spec/unit/mutant/transform/primitive_spec.rb index 2d52c4200..5aecfd611 100644 --- a/spec/unit/mutant/transform/primitive_spec.rb +++ b/spec/unit/mutant/transform/primitive_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe Mutant::Transform::Primitive do - subject { described_class.new(primitive: primitive) } + subject { described_class.new(primitive:) } let(:primitive) { String } @@ -42,7 +42,7 @@ def apply let(:error) do Mutant::Transform::Error.new( cause: nil, - input: input, + input:, message: 'Expected: String but got: Integer', transform: subject ) diff --git a/spec/unit/mutant/transform/sequence_spec.rb b/spec/unit/mutant/transform/sequence_spec.rb index 9a28de66a..c1daf601f 100644 --- a/spec/unit/mutant/transform/sequence_spec.rb +++ b/spec/unit/mutant/transform/sequence_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe Mutant::Transform::Sequence do - subject { described_class.new(steps: steps) } + subject { described_class.new(steps:) } let(:steps) do [ @@ -63,7 +63,7 @@ def apply let(:hash_error) do Mutant::Transform::Error.new( cause: key_error, - input: input, + input:, message: nil, transform: hash_transform ) @@ -72,7 +72,7 @@ def apply let(:index_error) do Mutant::Transform::Error.new( cause: hash_error, - input: input, + input:, message: nil, transform: Mutant::Transform::Index.new( index: 0, @@ -84,7 +84,7 @@ def apply let(:error) do Mutant::Transform::Error.new( cause: index_error, - input: input, + input:, message: nil, transform: subject ) diff --git a/spec/unit/mutant/transform/success_spec.rb b/spec/unit/mutant/transform/success_spec.rb index 84695c74f..79bc8deb5 100644 --- a/spec/unit/mutant/transform/success_spec.rb +++ b/spec/unit/mutant/transform/success_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe Mutant::Transform::Success do - subject { described_class.new(block: block) } + subject { described_class.new(block:) } let(:block) { ->(value) { value * 2 } } diff --git a/spec/unit/mutant/variable_spec.rb b/spec/unit/mutant/variable_spec.rb index 24f3ef812..c54f02cdf 100644 --- a/spec/unit/mutant/variable_spec.rb +++ b/spec/unit/mutant/variable_spec.rb @@ -13,7 +13,7 @@ def full(value) described_class.new( condition_variable: condition_variable_class, mutex: mutex_class, - value: value + value: ) end diff --git a/spec/unit/mutant/world_spec.rb b/spec/unit/mutant/world_spec.rb index 717ce8974..80fb77938 100644 --- a/spec/unit/mutant/world_spec.rb +++ b/spec/unit/mutant/world_spec.rb @@ -26,7 +26,7 @@ def apply describe '#record' do subject do super().with( - recorder: recorder + recorder: ) end @@ -62,14 +62,14 @@ def apply let(:open3) { class_double(Open3) } let(:stdout) { instance_double(String, :stdout) } let(:stderr) { instance_double(String, :stderr) } - let(:subject) { super().with(open3: open3) } - let(:command) { %w[foo bar baz] } + let(:subject) { super().with(open3:) } + let(:command) { %w[foo bar baz] } let(:command_status) do described_class::CommandStatus.new( - process_status: process_status, - stderr: stderr, - stdout: stdout + process_status:, + stderr:, + stdout: ) end @@ -121,7 +121,7 @@ def apply expect(apply).to eql( Mutant::Timer::Deadline.new( timer: subject.timer, - allowed_time: allowed_time + allowed_time: ) ) end @@ -153,7 +153,7 @@ def apply describe '#process_warmup' do let(:process) { double(Process) } - subject { super().with(process: process) } + subject { super().with(process:) } def apply subject.process_warmup diff --git a/spec/unit/mutant/zombifier_spec.rb b/spec/unit/mutant/zombifier_spec.rb index a182b6b24..58e608076 100644 --- a/spec/unit/mutant/zombifier_spec.rb +++ b/spec/unit/mutant/zombifier_spec.rb @@ -20,9 +20,9 @@ load_path: %w[a b], includes: %w[project bar], namespace: :Zombie, - require_highjack: require_highjack, - root_require: root_require, - pathname: pathname, + require_highjack:, + root_require:, + pathname:, kernel: ruby_vm } end diff --git a/test_app/Gemfile.minitest.lock b/test_app/Gemfile.minitest.lock index 9a74e3b47..2b3d7012b 100644 --- a/test_app/Gemfile.minitest.lock +++ b/test_app/Gemfile.minitest.lock @@ -1,15 +1,15 @@ PATH remote: .. specs: - mutant (0.12.2) + mutant (0.12.3) diff-lcs (~> 1.3) parser (~> 3.3.0) regexp_parser (~> 2.9.0) sorbet-runtime (~> 0.5.0) - unparser (~> 0.6.9) - mutant-minitest (0.12.2) + unparser (~> 0.6.14) + mutant-minitest (0.12.3) minitest (~> 5.11) - mutant (= 0.12.2) + mutant (= 0.12.3) GEM remote: https://rubygems.org/ @@ -23,9 +23,9 @@ GEM racc (1.7.1) regexp_parser (2.9.0) sorbet-runtime (0.5.10607) - unparser (0.6.9) + unparser (0.6.14) diff-lcs (~> 1.3) - parser (>= 3.2.2.4) + parser (>= 3.3.0) PLATFORMS x86_64-linux diff --git a/test_app/Gemfile.rspec3.10.lock b/test_app/Gemfile.rspec3.10.lock index 0e6fac8f8..962c100f2 100644 --- a/test_app/Gemfile.rspec3.10.lock +++ b/test_app/Gemfile.rspec3.10.lock @@ -1,14 +1,14 @@ PATH remote: .. specs: - mutant (0.12.2) + mutant (0.12.3) diff-lcs (~> 1.3) parser (~> 3.3.0) regexp_parser (~> 2.9.0) sorbet-runtime (~> 0.5.0) - unparser (~> 0.6.9) - mutant-rspec (0.12.2) - mutant (= 0.12.2) + unparser (~> 0.6.14) + mutant-rspec (0.12.3) + mutant (= 0.12.3) rspec-core (>= 3.8.0, < 4.0.0) GEM @@ -42,7 +42,7 @@ GEM rspec-support (3.13.1) sorbet-runtime (0.5.11292) thread_safe (0.3.6) - unparser (0.6.13) + unparser (0.6.14) diff-lcs (~> 1.3) parser (>= 3.3.0) diff --git a/test_app/Gemfile.rspec3.11.lock b/test_app/Gemfile.rspec3.11.lock index 6e5eb384f..b441444e4 100644 --- a/test_app/Gemfile.rspec3.11.lock +++ b/test_app/Gemfile.rspec3.11.lock @@ -1,14 +1,14 @@ PATH remote: .. specs: - mutant (0.12.2) + mutant (0.12.3) diff-lcs (~> 1.3) parser (~> 3.3.0) regexp_parser (~> 2.9.0) sorbet-runtime (~> 0.5.0) - unparser (~> 0.6.9) - mutant-rspec (0.12.2) - mutant (= 0.12.2) + unparser (~> 0.6.14) + mutant-rspec (0.12.3) + mutant (= 0.12.3) rspec-core (>= 3.8.0, < 4.0.0) GEM @@ -42,7 +42,7 @@ GEM rspec-support (3.13.1) sorbet-runtime (0.5.11292) thread_safe (0.3.6) - unparser (0.6.13) + unparser (0.6.14) diff-lcs (~> 1.3) parser (>= 3.3.0) diff --git a/test_app/Gemfile.rspec3.12.lock b/test_app/Gemfile.rspec3.12.lock index c5d15682b..d7472afe9 100644 --- a/test_app/Gemfile.rspec3.12.lock +++ b/test_app/Gemfile.rspec3.12.lock @@ -1,14 +1,14 @@ PATH remote: .. specs: - mutant (0.12.2) + mutant (0.12.3) diff-lcs (~> 1.3) parser (~> 3.3.0) regexp_parser (~> 2.9.0) sorbet-runtime (~> 0.5.0) - unparser (~> 0.6.9) - mutant-rspec (0.12.2) - mutant (= 0.12.2) + unparser (~> 0.6.14) + mutant-rspec (0.12.3) + mutant (= 0.12.3) rspec-core (>= 3.8.0, < 4.0.0) GEM @@ -42,7 +42,7 @@ GEM rspec-support (3.13.1) sorbet-runtime (0.5.11292) thread_safe (0.3.6) - unparser (0.6.13) + unparser (0.6.14) diff-lcs (~> 1.3) parser (>= 3.3.0) diff --git a/test_app/Gemfile.rspec3.13.lock b/test_app/Gemfile.rspec3.13.lock index bf6c0c60b..c7ee091d9 100644 --- a/test_app/Gemfile.rspec3.13.lock +++ b/test_app/Gemfile.rspec3.13.lock @@ -1,14 +1,14 @@ PATH remote: .. specs: - mutant (0.12.2) + mutant (0.12.3) diff-lcs (~> 1.3) parser (~> 3.3.0) regexp_parser (~> 2.9.0) sorbet-runtime (~> 0.5.0) - unparser (~> 0.6.9) - mutant-rspec (0.12.2) - mutant (= 0.12.2) + unparser (~> 0.6.14) + mutant-rspec (0.12.3) + mutant (= 0.12.3) rspec-core (>= 3.8.0, < 4.0.0) GEM @@ -42,7 +42,7 @@ GEM rspec-support (3.13.1) sorbet-runtime (0.5.11292) thread_safe (0.3.6) - unparser (0.6.13) + unparser (0.6.14) diff-lcs (~> 1.3) parser (>= 3.3.0) diff --git a/test_app/Gemfile.rspec3.8.lock b/test_app/Gemfile.rspec3.8.lock index 00be2e3c2..d657b3685 100644 --- a/test_app/Gemfile.rspec3.8.lock +++ b/test_app/Gemfile.rspec3.8.lock @@ -1,14 +1,14 @@ PATH remote: .. specs: - mutant (0.12.2) + mutant (0.12.3) diff-lcs (~> 1.3) parser (~> 3.3.0) regexp_parser (~> 2.9.0) sorbet-runtime (~> 0.5.0) - unparser (~> 0.6.9) - mutant-rspec (0.12.2) - mutant (= 0.12.2) + unparser (~> 0.6.14) + mutant-rspec (0.12.3) + mutant (= 0.12.3) rspec-core (>= 3.8.0, < 4.0.0) GEM @@ -42,9 +42,9 @@ GEM rspec-support (3.8.3) sorbet-runtime (0.5.10607) thread_safe (0.3.6) - unparser (0.6.9) + unparser (0.6.14) diff-lcs (~> 1.3) - parser (>= 3.2.2.4) + parser (>= 3.3.0) PLATFORMS x86_64-linux diff --git a/test_app/Gemfile.rspec3.9.lock b/test_app/Gemfile.rspec3.9.lock index c5d15682b..d7472afe9 100644 --- a/test_app/Gemfile.rspec3.9.lock +++ b/test_app/Gemfile.rspec3.9.lock @@ -1,14 +1,14 @@ PATH remote: .. specs: - mutant (0.12.2) + mutant (0.12.3) diff-lcs (~> 1.3) parser (~> 3.3.0) regexp_parser (~> 2.9.0) sorbet-runtime (~> 0.5.0) - unparser (~> 0.6.9) - mutant-rspec (0.12.2) - mutant (= 0.12.2) + unparser (~> 0.6.14) + mutant-rspec (0.12.3) + mutant (= 0.12.3) rspec-core (>= 3.8.0, < 4.0.0) GEM @@ -42,7 +42,7 @@ GEM rspec-support (3.13.1) sorbet-runtime (0.5.11292) thread_safe (0.3.6) - unparser (0.6.13) + unparser (0.6.14) diff-lcs (~> 1.3) parser (>= 3.3.0)