Module: Mutineer

Defined in:
lib/mutineer.rb,
lib/mutineer/cli.rb,
lib/mutineer/init.rb,
lib/mutineer/config.rb,
lib/mutineer/parser.rb,
lib/mutineer/result.rb,
lib/mutineer/runner.rb,
lib/mutineer/triage.rb,
lib/mutineer/fs_path.rb,
lib/mutineer/migrate.rb,
lib/mutineer/pairing.rb,
lib/mutineer/project.rb,
lib/mutineer/subject.rb,
lib/mutineer/version.rb,
lib/mutineer/baseline.rb,
lib/mutineer/job_plan.rb,
lib/mutineer/mutation.rb,
lib/mutineer/progress.rb,
lib/mutineer/reporter.rb,
lib/mutineer/run_seed.rb,
lib/mutineer/file_swap.rb,
lib/mutineer/isolation.rb,
lib/mutineer/mutant_id.rb,
lib/mutineer/redaction.rb,
lib/mutineer/child_cause.rb,
lib/mutineer/kill_matrix.rb,
lib/mutineer/reach_probe.rb,
lib/mutineer/worker_pool.rb,
lib/mutineer/child_stdout.rb,
lib/mutineer/coverage_map.rb,
lib/mutineer/kill_channel.rb,
lib/mutineer/orphan_guard.rb,
lib/mutineer/project_path.rb,
lib/mutineer/source_bytes.rb,
lib/mutineer/test_runners.rb,
lib/mutineer/changed_lines.rb,
lib/mutineer/daemon_client.rb,
lib/mutineer/daemon_server.rb,
lib/mutineer/database_urls.rb,
lib/mutineer/mutators/base.rb,
lib/mutineer/output_filter.rb,
lib/mutineer/rails_run_env.rb,
lib/mutineer/reload_guards.rb,
lib/mutineer/child_coverage.rb,
lib/mutineer/command_redact.rb,
lib/mutineer/concern_blocks.rb,
lib/mutineer/daemon_backend.rb,
lib/mutineer/rails_worker_db.rb,
lib/mutineer/statement_lines.rb,
lib/mutineer/external_backend.rb,
lib/mutineer/mutator_registry.rb,
lib/mutineer/test_runners/rspec.rb,
lib/mutineer/mutators/arithmetic.rb,
lib/mutineer/mutators/chain_link.rb,
lib/mutineer/mutators/comparison.rb,
lib/mutineer/mutators/return_nil.rb,
lib/mutineer/minitest_integration.rb,
lib/mutineer/mutators/rescue_body.rb,
lib/mutineer/test_runners/minitest.rb,
lib/mutineer/mutators/array_literal.rb,
lib/mutineer/mutators/range_literal.rb,
lib/mutineer/mutators/regex_literal.rb,
lib/mutineer/mutators/string_literal.rb,
lib/mutineer/test_runners/rspec_seed.rb,
lib/mutineer/mutators/boolean_literal.rb,
lib/mutineer/mutators/operand_removal.rb,
lib/mutineer/mutators/safe_navigation.rb,
lib/mutineer/mutators/call_to_receiver.rb,
lib/mutineer/mutators/literal_mutation.rb,
lib/mutineer/mutators/negation_removal.rb,
lib/mutineer/mutators/boolean_connector.rb,
lib/mutineer/mutators/collection_method.rb,
lib/mutineer/mutators/condition_forcing.rb,
lib/mutineer/mutators/statement_removal.rb,
lib/mutineer/mutators/condition_negation.rb,
lib/mutineer/mutators/operator_assignment.rb,
lib/mutineer/minitest_integration/file_order.rb,
lib/mutineer/minitest_integration/kill_recorder.rb,
lib/mutineer/minitest_integration/outer_reporter.rb,
lib/mutineer/minitest_integration/stop_at_first_failure.rb,
lib/mutineer/minitest_integration/in_test_database_error.rb

Overview

Mutineer is the top-level namespace for the mutation-testing library.

Defined Under Namespace

Modules: ChangedLines, ChildCause, ChildCoverage, ChildStdout, CommandRedact, ConcernBlocks, DaemonBackend, DaemonServer, DatabaseUrls, ExternalBackend, FileSwap, FsPath, Init, JobPlan, KillChannel, Migrate, MutantId, Mutators, OrphanGuard, OutputFilter, Pairing, ProjectPath, RailsRunEnv, RailsWorkerDb, ReachProbe, Redaction, ReloadGuards, RunSeed, SourceBytes, StatementLines, TestRunners, Triage Classes: AggregateResult, Baseline, CLI, ConcurrentRunError, Config, ConfigError, ConfigOption, CoverageFromError, CoverageMap, DaemonBootError, DaemonBootTimeout, DaemonClient, FrameworkUnavailable, Isolation, KillMatrix, Kills, MinitestIntegration, Mutation, MutatorRegistry, ParseError, Parser, Progress, Project, ProjectLoadError, Reporter, Result, Runner, SmokeCheckError, Subject, WorkerPool

Constant Summary collapse

BECOMES_ERROR_IN_2_0 =

The phrase every 1.x warning uses for behaviour that 2.0 turns into an error, so the 2.0 release can find each of those sites with one search.

"this becomes an error in Mutineer 2.0"
STRATEGY_ALIASES =

Deprecated internal strategy names, mapped to their canonical equivalents.

{ "7a" => "reload", "7b" => "redefine" }.freeze
CONFIG_OPTIONS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

The option schema. Config.parse is the only place that turns a raw value (a CLI string or a YAML scalar) into a typed one, so a value is checked once, at the boundary, whichever layer wrote it. Row order fixes the order of KNOWN_KEYS in warnings.

[
  ConfigOption.new(field: :operators, type: :string_list, yaml_key: "operators", flag: "--operators"),
  ConfigOption.new(field: :jobs, type: :positive_int, yaml_key: "jobs", flag: "--jobs"),
  ConfigOption.new(field: :threshold, type: :percent, yaml_key: "threshold", flag: "--threshold"),
  ConfigOption.new(field: :only, type: :string, yaml_key: "only", flag: "--only"),
  ConfigOption.new(field: :require_paths, type: :string_list, yaml_key: "require"),
  ConfigOption.new(field: :boot, type: :string, yaml_key: "boot", flag: "--boot"),
  ConfigOption.new(field: :rails, type: :bool, yaml_key: "rails", flag: "--rails"),
  ConfigOption.new(field: :since, type: :since, yaml_key: "since", flag: "--since"),
  ConfigOption.new(field: :framework, type: :enum, yaml_key: "framework", flag: "--framework",
                   values: %w[minitest rspec]),
  ConfigOption.new(field: :verbose, type: :bool, yaml_key: "verbose", flag: "--verbose"),
  ConfigOption.new(field: :ignore, type: :ignore_list, yaml_key: "ignore"),
  ConfigOption.new(field: :baseline, type: :string, yaml_key: "baseline", flag: "--baseline"),
  ConfigOption.new(field: :fail_fast, type: :bool, yaml_key: "fail_fast", flag: "--fail-fast"),
  ConfigOption.new(field: :matrix, type: :bool, yaml_key: "matrix", flag: "--matrix"),
  ConfigOption.new(field: :test_command, type: :string, yaml_key: "test_command", flag: "--test-command"),
  ConfigOption.new(field: :daemon, type: :bool, yaml_key: "daemon", flag: "--daemon"),
  ConfigOption.new(field: :timeout, type: :positive_int, yaml_key: "timeout", flag: "--timeout"),
  ConfigOption.new(field: :capture_timeout, type: :positive_int, yaml_key: "capture_timeout",
                   flag: "--capture-timeout"),
  ConfigOption.new(field: :cache_dir, type: :string, yaml_key: "cache_dir", flag: "--cache-dir"),
  ConfigOption.new(field: :allow_empty, type: :bool, yaml_key: "allow_empty", flag: "--allow-empty"),
  ConfigOption.new(field: :shared_databases, type: :string_list, yaml_key: "shared_databases"),
  # YAML-only: pairs source patterns with extra test patterns for pairing (#382).
  ConfigOption.new(field: :test_map, type: :test_map, yaml_key: "tests"),
  ConfigOption.new(field: :coverage_from, type: :string, flag: "--coverage-from"),
  ConfigOption.new(field: :format, type: :enum, flag: "--format", values: %w[human json html]),
  ConfigOption.new(field: :strategy, type: :enum, flag: "--strategy", values: %w[reload redefine],
                   aliases: STRATEGY_ALIASES),
  ConfigOption.new(field: :output, type: :string, flag: "--output"),
  ConfigOption.new(field: :baseline_epsilon, type: :nonneg_float, flag: "--baseline-epsilon"),
  ConfigOption.new(field: :dry_run, type: :bool, flag: "--dry-run")
].freeze
VERSION =

Current Mutineer release version.

"1.9.0"

Class Method Summary collapse

Class Method Details

.did_you_mean(word, candidates) ⇒ String

A "did you mean" hint for a misspelled name, using the stdlib spell checker that Ruby itself uses for NameError.

Parameters:

  • word (String) —

    the name the user wrote.

  • candidates (Array<String>) —

    the names that are valid here.

Returns:

  • (String) —

    (did you mean "x"?) for the closest candidate, or "" when none is close.



19
20
21
22
# File 'lib/mutineer/config.rb', line 19

def self.did_you_mean(word, candidates)
  match = DidYouMean::SpellChecker.new(dictionary: candidates).correct(word.to_s).first
  match ? " (did you mean #{match.inspect}?)" : ""
end