Remove redundant freeze calls
* Rubocop meanwhile knows the singleton class problem.
This commit is contained in:
parent
9bda1d354f
commit
cb2ca5132e
33 changed files with 54 additions and 58 deletions
|
@ -150,10 +150,6 @@ SignalException:
|
||||||
Alias:
|
Alias:
|
||||||
EnforcedStyle: prefer_alias_method
|
EnforcedStyle: prefer_alias_method
|
||||||
|
|
||||||
# Teaching people to ignore singleton class is pointless
|
|
||||||
RedundantFreeze:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Do not waste my horizontal or vertical space
|
# Do not waste my horizontal or vertical space
|
||||||
IndentArray:
|
IndentArray:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
|
@ -29,10 +29,10 @@ Thread.abort_on_exception = true
|
||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
module Mutant
|
module Mutant
|
||||||
EMPTY_STRING = ''.freeze
|
EMPTY_STRING = ''
|
||||||
EMPTY_ARRAY = [].freeze
|
EMPTY_ARRAY = [].freeze
|
||||||
EMPTY_HASH = {}.freeze
|
EMPTY_HASH = {}.freeze
|
||||||
SCOPE_OPERATOR = '::'.freeze
|
SCOPE_OPERATOR = '::'
|
||||||
|
|
||||||
# Test if CI is detected via environment
|
# Test if CI is detected via environment
|
||||||
#
|
#
|
||||||
|
|
|
@ -10,7 +10,7 @@ module Mutant
|
||||||
|
|
||||||
# Undefined message payload
|
# Undefined message payload
|
||||||
Undefined = Class.new do
|
Undefined = Class.new do
|
||||||
INSPECT = 'Mutant::Actor::Undefined'.freeze
|
INSPECT = 'Mutant::Actor::Undefined'
|
||||||
|
|
||||||
# Object inspection
|
# Object inspection
|
||||||
#
|
#
|
||||||
|
|
|
@ -9,7 +9,7 @@ module Mutant
|
||||||
class Optarg
|
class Optarg
|
||||||
include NamedChildren, Concord.new(:node)
|
include NamedChildren, Concord.new(:node)
|
||||||
|
|
||||||
UNDERSCORE = '_'.freeze
|
UNDERSCORE = '_'
|
||||||
|
|
||||||
children :name, :default_value
|
children :name, :default_value
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ module Mutant
|
||||||
public :receiver, :selector
|
public :receiver, :selector
|
||||||
|
|
||||||
INDEX_ASSIGNMENT_SELECTOR = :[]=
|
INDEX_ASSIGNMENT_SELECTOR = :[]=
|
||||||
ATTRIBUTE_ASSIGNMENT_SELECTOR_SUFFIX = '='.freeze
|
ATTRIBUTE_ASSIGNMENT_SELECTOR_SUFFIX = '='
|
||||||
|
|
||||||
# Arguments of mutated node
|
# Arguments of mutated node
|
||||||
#
|
#
|
||||||
|
|
|
@ -6,7 +6,7 @@ module Mutant
|
||||||
include Adamantium::Flat, Concord::Public.new(:scope, :source_path)
|
include Adamantium::Flat, Concord::Public.new(:scope, :source_path)
|
||||||
extend AST::Sexp
|
extend AST::Sexp
|
||||||
|
|
||||||
NAMESPACE_DELIMITER = '::'.freeze
|
NAMESPACE_DELIMITER = '::'
|
||||||
|
|
||||||
# Return root node for mutation
|
# Return root node for mutation
|
||||||
#
|
#
|
||||||
|
|
|
@ -5,9 +5,9 @@ module Mutant
|
||||||
class Diff
|
class Diff
|
||||||
include Adamantium::Flat, Concord.new(:old, :new)
|
include Adamantium::Flat, Concord.new(:old, :new)
|
||||||
|
|
||||||
ADDITION = '+'.freeze
|
ADDITION = '+'
|
||||||
DELETION = '-'.freeze
|
DELETION = '-'
|
||||||
NEWLINE = "\n".freeze
|
NEWLINE = "\n"
|
||||||
|
|
||||||
# Unified source diff between old and new
|
# Unified source diff between old and new
|
||||||
#
|
#
|
||||||
|
|
|
@ -16,7 +16,7 @@ module Mutant
|
||||||
|
|
||||||
SEMANTICS_MESSAGE =
|
SEMANTICS_MESSAGE =
|
||||||
"Fix your lib to follow normal ruby semantics!\n" \
|
"Fix your lib to follow normal ruby semantics!\n" \
|
||||||
'{Module,Class}#name should return resolvable constant name as String or nil'.freeze
|
'{Module,Class}#name should return resolvable constant name as String or nil'
|
||||||
|
|
||||||
# Kill mutation
|
# Kill mutation
|
||||||
#
|
#
|
||||||
|
|
6
lib/mutant/env/bootstrap.rb
vendored
6
lib/mutant/env/bootstrap.rb
vendored
|
@ -8,13 +8,13 @@ module Mutant
|
||||||
|
|
||||||
SEMANTICS_MESSAGE_FORMAT =
|
SEMANTICS_MESSAGE_FORMAT =
|
||||||
"%<message>s. Fix your lib to follow normal ruby semantics!\n" \
|
"%<message>s. Fix your lib to follow normal ruby semantics!\n" \
|
||||||
'{Module,Class}#name should return resolvable constant name as String or nil'.freeze
|
'{Module,Class}#name should return resolvable constant name as String or nil'
|
||||||
|
|
||||||
CLASS_NAME_RAISED_EXCEPTION =
|
CLASS_NAME_RAISED_EXCEPTION =
|
||||||
'%<scope_class>s#name from: %<scope>s raised an error: %<exception>s'.freeze
|
'%<scope_class>s#name from: %<scope>s raised an error: %<exception>s'
|
||||||
|
|
||||||
CLASS_NAME_TYPE_MISMATCH_FORMAT =
|
CLASS_NAME_TYPE_MISMATCH_FORMAT =
|
||||||
'%<scope_class>s#name from: %<scope>s returned %<name>s'.freeze
|
'%<scope_class>s#name from: %<scope>s returned %<name>s'
|
||||||
|
|
||||||
private_constant(*constants(false))
|
private_constant(*constants(false))
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ module Mutant
|
||||||
|
|
||||||
fragment = /[A-Za-z][A-Za-z\d_]*/.freeze
|
fragment = /[A-Za-z][A-Za-z\d_]*/.freeze
|
||||||
SCOPE_NAME_PATTERN = /(?<scope_name>#{fragment}(?:#{SCOPE_OPERATOR}#{fragment})*)/.freeze
|
SCOPE_NAME_PATTERN = /(?<scope_name>#{fragment}(?:#{SCOPE_OPERATOR}#{fragment})*)/.freeze
|
||||||
SCOPE_SYMBOL_PATTERN = '(?<scope_symbol>[.#])'.freeze
|
SCOPE_SYMBOL_PATTERN = '(?<scope_symbol>[.#])'
|
||||||
|
|
||||||
private_constant(*constants(false))
|
private_constant(*constants(false))
|
||||||
|
|
||||||
|
|
|
@ -25,10 +25,10 @@ module Mutant
|
||||||
|
|
||||||
ALL_EXPRESSION = Expression::Namespace::Recursive.new(scope_name: nil)
|
ALL_EXPRESSION = Expression::Namespace::Recursive.new(scope_name: nil)
|
||||||
EXPRESSION_CANDIDATE = /\A([^ ]+)(?: )?/.freeze
|
EXPRESSION_CANDIDATE = /\A([^ ]+)(?: )?/.freeze
|
||||||
LOCATION_DELIMITER = ':'.freeze
|
LOCATION_DELIMITER = ':'
|
||||||
EXIT_SUCCESS = 0
|
EXIT_SUCCESS = 0
|
||||||
CLI_OPTIONS = IceNine.deep_freeze(%w[spec --fail-fast])
|
CLI_OPTIONS = IceNine.deep_freeze(%w[spec --fail-fast])
|
||||||
TEST_ID_FORMAT = 'rspec:%<index>d:%<location>s/%<description>s'.freeze
|
TEST_ID_FORMAT = 'rspec:%<index>d:%<location>s/%<description>s'
|
||||||
|
|
||||||
private_constant(*constants(false))
|
private_constant(*constants(false))
|
||||||
|
|
||||||
|
|
|
@ -12,11 +12,11 @@ module Mutant
|
||||||
:subject_filters
|
:subject_filters
|
||||||
)
|
)
|
||||||
|
|
||||||
INSPECT_FORMAT = "#<#{self} %s>".freeze
|
INSPECT_FORMAT = "#<#{self} %s>"
|
||||||
ATTRIBUTE_DELIMITER = ' '.freeze
|
ATTRIBUTE_DELIMITER = ' '
|
||||||
ATTRIBUTE_FORMAT = '%s: [%s]'.freeze
|
ATTRIBUTE_FORMAT = '%s: [%s]'
|
||||||
ENUM_DELIMITER = ','.freeze
|
ENUM_DELIMITER = ','
|
||||||
EMPTY_ATTRIBUTES = 'empty'.freeze
|
EMPTY_ATTRIBUTES = 'empty'
|
||||||
PRESENTATIONS = IceNine.deep_freeze(
|
PRESENTATIONS = IceNine.deep_freeze(
|
||||||
ignore_expressions: :syntax,
|
ignore_expressions: :syntax,
|
||||||
match_expressions: :syntax,
|
match_expressions: :syntax,
|
||||||
|
|
|
@ -13,10 +13,10 @@ module Mutant
|
||||||
BLACKLIST = %r{\A(kernel/|\(eval\)\z)}.freeze
|
BLACKLIST = %r{\A(kernel/|\(eval\)\z)}.freeze
|
||||||
|
|
||||||
SOURCE_LOCATION_WARNING_FORMAT =
|
SOURCE_LOCATION_WARNING_FORMAT =
|
||||||
'%s does not have a valid source location, unable to emit subject'.freeze
|
'%s does not have a valid source location, unable to emit subject'
|
||||||
|
|
||||||
CLOSURE_WARNING_FORMAT =
|
CLOSURE_WARNING_FORMAT =
|
||||||
'%s is dynamically defined in a closure, unable to emit subject'.freeze
|
'%s is dynamically defined in a closure, unable to emit subject'
|
||||||
|
|
||||||
# Matched subjects
|
# Matched subjects
|
||||||
#
|
#
|
||||||
|
|
|
@ -21,7 +21,7 @@ module Mutant
|
||||||
SUBJECT_CLASS = Subject::Method::Singleton
|
SUBJECT_CLASS = Subject::Method::Singleton
|
||||||
RECEIVER_INDEX = 0
|
RECEIVER_INDEX = 0
|
||||||
NAME_INDEX = 1
|
NAME_INDEX = 1
|
||||||
RECEIVER_WARNING = 'Can only match :defs on :self or :const got %p unable to match'.freeze
|
RECEIVER_WARNING = 'Can only match :defs on :self or :const got %p unable to match'
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ module Mutant
|
||||||
include AbstractType, Adamantium::Flat
|
include AbstractType, Adamantium::Flat
|
||||||
include Concord::Public.new(:subject, :node)
|
include Concord::Public.new(:subject, :node)
|
||||||
|
|
||||||
CODE_DELIMITER = "\0".freeze
|
CODE_DELIMITER = "\0"
|
||||||
CODE_RANGE = (0..4).freeze
|
CODE_RANGE = (0..4).freeze
|
||||||
|
|
||||||
# Identification string
|
# Identification string
|
||||||
|
@ -86,7 +86,7 @@ module Mutant
|
||||||
# Evil mutation that should case mutations to fail tests
|
# Evil mutation that should case mutations to fail tests
|
||||||
class Evil < self
|
class Evil < self
|
||||||
|
|
||||||
SYMBOL = 'evil'.freeze
|
SYMBOL = 'evil'
|
||||||
TEST_PASS_SUCCESS = false
|
TEST_PASS_SUCCESS = false
|
||||||
|
|
||||||
end # Evil
|
end # Evil
|
||||||
|
@ -94,7 +94,7 @@ module Mutant
|
||||||
# Neutral mutation that should not cause mutations to fail tests
|
# Neutral mutation that should not cause mutations to fail tests
|
||||||
class Neutral < self
|
class Neutral < self
|
||||||
|
|
||||||
SYMBOL = 'neutral'.freeze
|
SYMBOL = 'neutral'
|
||||||
TEST_PASS_SUCCESS = true
|
TEST_PASS_SUCCESS = true
|
||||||
|
|
||||||
end # Neutral
|
end # Neutral
|
||||||
|
@ -102,7 +102,7 @@ module Mutant
|
||||||
# Noop mutation, special case of neutral
|
# Noop mutation, special case of neutral
|
||||||
class Noop < Neutral
|
class Noop < Neutral
|
||||||
|
|
||||||
SYMBOL = 'noop'.freeze
|
SYMBOL = 'noop'
|
||||||
TEST_PASS_SUCCESS = true
|
TEST_PASS_SUCCESS = true
|
||||||
|
|
||||||
end # Noop
|
end # Noop
|
||||||
|
|
|
@ -8,7 +8,7 @@ module Mutant
|
||||||
class Argument < self
|
class Argument < self
|
||||||
handle(:arg, :kwarg)
|
handle(:arg, :kwarg)
|
||||||
|
|
||||||
UNDERSCORE = '_'.freeze
|
UNDERSCORE = '_'
|
||||||
|
|
||||||
children :name
|
children :name
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ module Mutant
|
||||||
handle(:regexp)
|
handle(:regexp)
|
||||||
|
|
||||||
# No input can ever be matched with this
|
# No input can ever be matched with this
|
||||||
NULL_REGEXP_SOURCE = 'nomatch\A'.freeze
|
NULL_REGEXP_SOURCE = 'nomatch\A'
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ module Mutant
|
||||||
|
|
||||||
children :value
|
children :value
|
||||||
|
|
||||||
PREFIX = '__mutant__'.freeze
|
PREFIX = '__mutant__'
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ module Mutant
|
||||||
# Utility symbol mutator
|
# Utility symbol mutator
|
||||||
class Symbol < self
|
class Symbol < self
|
||||||
|
|
||||||
POSTFIX = '__mutant__'.freeze
|
POSTFIX = '__mutant__'
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ module Mutant
|
||||||
class Framed < self
|
class Framed < self
|
||||||
include anima.add(:tput)
|
include anima.add(:tput)
|
||||||
|
|
||||||
BUFFER_FLAGS = 'a+'.freeze
|
BUFFER_FLAGS = 'a+'
|
||||||
|
|
||||||
REPORT_FREQUENCY = 20.0
|
REPORT_FREQUENCY = 20.0
|
||||||
REPORT_DELAY = 1 / REPORT_FREQUENCY
|
REPORT_DELAY = 1 / REPORT_FREQUENCY
|
||||||
|
|
|
@ -35,7 +35,7 @@ module Mutant
|
||||||
|
|
||||||
delegate :success?
|
delegate :success?
|
||||||
|
|
||||||
NL = "\n".freeze
|
NL = "\n"
|
||||||
|
|
||||||
# Run printer
|
# Run printer
|
||||||
#
|
#
|
||||||
|
|
|
@ -6,8 +6,8 @@ module Mutant
|
||||||
class Printer
|
class Printer
|
||||||
# Printer for mutation progress results
|
# Printer for mutation progress results
|
||||||
class MutationProgressResult < self
|
class MutationProgressResult < self
|
||||||
SUCCESS = '.'.freeze
|
SUCCESS = '.'
|
||||||
FAILURE = 'F'.freeze
|
FAILURE = 'F'
|
||||||
|
|
||||||
# Run printer
|
# Run printer
|
||||||
#
|
#
|
||||||
|
|
|
@ -9,8 +9,8 @@ module Mutant
|
||||||
|
|
||||||
delegate(:active_jobs, :payload)
|
delegate(:active_jobs, :payload)
|
||||||
|
|
||||||
ACTIVE_JOB_HEADER = 'Active Jobs:'.freeze
|
ACTIVE_JOB_HEADER = 'Active Jobs:'
|
||||||
ACTIVE_JOB_FORMAT = '%d: %s'.freeze
|
ACTIVE_JOB_FORMAT = '%d: %s'
|
||||||
|
|
||||||
# Print progress for collector
|
# Print progress for collector
|
||||||
#
|
#
|
||||||
|
|
|
@ -6,7 +6,7 @@ module Mutant
|
||||||
class Printer
|
class Printer
|
||||||
# Reporter for progressive output format on scheduler Status objects
|
# Reporter for progressive output format on scheduler Status objects
|
||||||
class StatusProgressive < self
|
class StatusProgressive < self
|
||||||
FORMAT = '(%02d/%02d) %3d%% - killtime: %0.02fs runtime: %0.02fs overhead: %0.02fs'.freeze
|
FORMAT = '(%02d/%02d) %3d%% - killtime: %0.02fs runtime: %0.02fs overhead: %0.02fs'
|
||||||
|
|
||||||
delegate(
|
delegate(
|
||||||
:coverage,
|
:coverage,
|
||||||
|
|
|
@ -6,7 +6,7 @@ module Mutant
|
||||||
class Printer
|
class Printer
|
||||||
# Reporter for subject progress
|
# Reporter for subject progress
|
||||||
class SubjectProgress < self
|
class SubjectProgress < self
|
||||||
FORMAT = '(%02d/%02d) %3d%% - killtime: %0.02fs runtime: %0.02fs overhead: %0.02fs'.freeze
|
FORMAT = '(%02d/%02d) %3d%% - killtime: %0.02fs runtime: %0.02fs overhead: %0.02fs'
|
||||||
|
|
||||||
delegate(
|
delegate(
|
||||||
:tests,
|
:tests,
|
||||||
|
|
|
@ -9,9 +9,9 @@ module Mutant
|
||||||
|
|
||||||
delegate :tests, :runtime
|
delegate :tests, :runtime
|
||||||
|
|
||||||
STATUS_FORMAT = '- %d @ runtime: %s'.freeze
|
STATUS_FORMAT = '- %d @ runtime: %s'
|
||||||
OUTPUT_HEADER = 'Test Output:'.freeze
|
OUTPUT_HEADER = 'Test Output:'
|
||||||
TEST_FORMAT = ' - %s'.freeze
|
TEST_FORMAT = ' - %s'
|
||||||
|
|
||||||
# Run test result reporter
|
# Run test result reporter
|
||||||
#
|
#
|
||||||
|
|
|
@ -24,7 +24,7 @@ module Mutant
|
||||||
class Diff
|
class Diff
|
||||||
include Adamantium, Anima.new(:config, :from, :to)
|
include Adamantium, Anima.new(:config, :from, :to)
|
||||||
|
|
||||||
HEAD = 'HEAD'.freeze
|
HEAD = 'HEAD'
|
||||||
|
|
||||||
# Test if diff changes file at line range
|
# Test if diff changes file at line range
|
||||||
#
|
#
|
||||||
|
|
|
@ -7,7 +7,7 @@ module Mutant
|
||||||
class Instance < self
|
class Instance < self
|
||||||
|
|
||||||
NAME_INDEX = 0
|
NAME_INDEX = 0
|
||||||
SYMBOL = '#'.freeze
|
SYMBOL = '#'
|
||||||
|
|
||||||
# Prepare subject for mutation insertion
|
# Prepare subject for mutation insertion
|
||||||
#
|
#
|
||||||
|
|
|
@ -7,7 +7,7 @@ module Mutant
|
||||||
class Singleton < self
|
class Singleton < self
|
||||||
|
|
||||||
NAME_INDEX = 1
|
NAME_INDEX = 1
|
||||||
SYMBOL = '.'.freeze
|
SYMBOL = '.'
|
||||||
|
|
||||||
# Prepare subject for mutation insertion
|
# Prepare subject for mutation insertion
|
||||||
#
|
#
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
module Mutant
|
module Mutant
|
||||||
# Current mutant version
|
# Current mutant version
|
||||||
VERSION = '0.8.23'.freeze
|
VERSION = '0.8.23'
|
||||||
end # Mutant
|
end # Mutant
|
||||||
|
|
|
@ -14,7 +14,7 @@ module MutantSpec
|
||||||
# rubocop:disable MethodLength
|
# rubocop:disable MethodLength
|
||||||
module Corpus
|
module Corpus
|
||||||
TMP = ROOT.join('tmp').freeze
|
TMP = ROOT.join('tmp').freeze
|
||||||
EXCLUDE_GLOB_FORMAT = '{%s}'.freeze
|
EXCLUDE_GLOB_FORMAT = '{%s}'
|
||||||
|
|
||||||
# Not in the docs. Number from chatting with their support.
|
# Not in the docs. Number from chatting with their support.
|
||||||
# 2 processors allocated per container, 4 processes works well.
|
# 2 processors allocated per container, 4 processes works well.
|
||||||
|
@ -27,9 +27,9 @@ module MutantSpec
|
||||||
class Project
|
class Project
|
||||||
MUTEX = Mutex.new
|
MUTEX = Mutex.new
|
||||||
|
|
||||||
MUTATION_GENERATION_MESSAGE = 'Total Mutations/Time/Parse-Errors: %s/%0.2fs - %0.2f/s'.freeze
|
MUTATION_GENERATION_MESSAGE = 'Total Mutations/Time/Parse-Errors: %s/%0.2fs - %0.2f/s'
|
||||||
START_MESSAGE = 'Starting - %s'.freeze
|
START_MESSAGE = 'Starting - %s'
|
||||||
FINISH_MESSAGE = 'Mutations - %4i - %s'.freeze
|
FINISH_MESSAGE = 'Mutations - %4i - %s'
|
||||||
|
|
||||||
DEFAULT_MUTATION_COUNT = 0
|
DEFAULT_MUTATION_COUNT = 0
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ module MutantSpec
|
||||||
# Mapping of files which we expect to cause errors during mutation generation
|
# Mapping of files which we expect to cause errors during mutation generation
|
||||||
class ErrorWhitelist
|
class ErrorWhitelist
|
||||||
class UnnecessaryExpectation < StandardError
|
class UnnecessaryExpectation < StandardError
|
||||||
MESSAGE = 'Expected to encounter %s while mutating "%s"'.freeze
|
MESSAGE = 'Expected to encounter %s while mutating "%s"'
|
||||||
|
|
||||||
def initialize(*error_info)
|
def initialize(*error_info)
|
||||||
super(MESSAGE % error_info)
|
super(MESSAGE % error_info)
|
||||||
|
|
|
@ -14,7 +14,7 @@ module MutantSpec
|
||||||
end
|
end
|
||||||
|
|
||||||
class UnexpectedWarnings < StandardError
|
class UnexpectedWarnings < StandardError
|
||||||
MSG = 'Unexpected warnings: %s'.freeze
|
MSG = 'Unexpected warnings: %s'
|
||||||
|
|
||||||
def initialize(warnings)
|
def initialize(warnings)
|
||||||
super(MSG % warnings.join("\n"))
|
super(MSG % warnings.join("\n"))
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
RSpec.describe Mutant::Mutation do
|
RSpec.describe Mutant::Mutation do
|
||||||
let(:mutation_class) do
|
let(:mutation_class) do
|
||||||
Class.new(Mutant::Mutation) do
|
Class.new(Mutant::Mutation) do
|
||||||
const_set(:SYMBOL, 'test'.freeze)
|
const_set(:SYMBOL, 'test')
|
||||||
const_set(:TEST_PASS_SUCCESS, true)
|
const_set(:TEST_PASS_SUCCESS, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue