Remove redundant freeze calls

* Rubocop meanwhile knows the singleton class problem.
This commit is contained in:
Markus Schirp 2018-12-25 11:42:51 +00:00
parent 9bda1d354f
commit cb2ca5132e
33 changed files with 54 additions and 58 deletions

View File

@ -150,10 +150,6 @@ SignalException:
Alias:
EnforcedStyle: prefer_alias_method
# Teaching people to ignore singleton class is pointless
RedundantFreeze:
Enabled: false
# Do not waste my horizontal or vertical space
IndentArray:
Enabled: false

View File

@ -29,10 +29,10 @@ Thread.abort_on_exception = true
#
# @api private
module Mutant
EMPTY_STRING = ''.freeze
EMPTY_STRING = ''
EMPTY_ARRAY = [].freeze
EMPTY_HASH = {}.freeze
SCOPE_OPERATOR = '::'.freeze
SCOPE_OPERATOR = '::'
# Test if CI is detected via environment
#

View File

@ -10,7 +10,7 @@ module Mutant
# Undefined message payload
Undefined = Class.new do
INSPECT = 'Mutant::Actor::Undefined'.freeze
INSPECT = 'Mutant::Actor::Undefined'
# Object inspection
#

View File

@ -9,7 +9,7 @@ module Mutant
class Optarg
include NamedChildren, Concord.new(:node)
UNDERSCORE = '_'.freeze
UNDERSCORE = '_'
children :name, :default_value

View File

@ -14,7 +14,7 @@ module Mutant
public :receiver, :selector
INDEX_ASSIGNMENT_SELECTOR = :[]=
ATTRIBUTE_ASSIGNMENT_SELECTOR_SUFFIX = '='.freeze
ATTRIBUTE_ASSIGNMENT_SELECTOR_SUFFIX = '='
# Arguments of mutated node
#

View File

@ -6,7 +6,7 @@ module Mutant
include Adamantium::Flat, Concord::Public.new(:scope, :source_path)
extend AST::Sexp
NAMESPACE_DELIMITER = '::'.freeze
NAMESPACE_DELIMITER = '::'
# Return root node for mutation
#

View File

@ -5,9 +5,9 @@ module Mutant
class Diff
include Adamantium::Flat, Concord.new(:old, :new)
ADDITION = '+'.freeze
DELETION = '-'.freeze
NEWLINE = "\n".freeze
ADDITION = '+'
DELETION = '-'
NEWLINE = "\n"
# Unified source diff between old and new
#

View File

@ -16,7 +16,7 @@ module Mutant
SEMANTICS_MESSAGE =
"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
#

View File

@ -8,13 +8,13 @@ module Mutant
SEMANTICS_MESSAGE_FORMAT =
"%<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 =
'%<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 =
'%<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))

View File

@ -8,7 +8,7 @@ module Mutant
fragment = /[A-Za-z][A-Za-z\d_]*/.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))

View File

@ -25,10 +25,10 @@ module Mutant
ALL_EXPRESSION = Expression::Namespace::Recursive.new(scope_name: nil)
EXPRESSION_CANDIDATE = /\A([^ ]+)(?: )?/.freeze
LOCATION_DELIMITER = ':'.freeze
LOCATION_DELIMITER = ':'
EXIT_SUCCESS = 0
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))

View File

@ -12,11 +12,11 @@ module Mutant
:subject_filters
)
INSPECT_FORMAT = "#<#{self} %s>".freeze
ATTRIBUTE_DELIMITER = ' '.freeze
ATTRIBUTE_FORMAT = '%s: [%s]'.freeze
ENUM_DELIMITER = ','.freeze
EMPTY_ATTRIBUTES = 'empty'.freeze
INSPECT_FORMAT = "#<#{self} %s>"
ATTRIBUTE_DELIMITER = ' '
ATTRIBUTE_FORMAT = '%s: [%s]'
ENUM_DELIMITER = ','
EMPTY_ATTRIBUTES = 'empty'
PRESENTATIONS = IceNine.deep_freeze(
ignore_expressions: :syntax,
match_expressions: :syntax,

View File

@ -13,10 +13,10 @@ module Mutant
BLACKLIST = %r{\A(kernel/|\(eval\)\z)}.freeze
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 =
'%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
#

View File

@ -21,7 +21,7 @@ module Mutant
SUBJECT_CLASS = Subject::Method::Singleton
RECEIVER_INDEX = 0
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

View File

@ -6,7 +6,7 @@ module Mutant
include AbstractType, Adamantium::Flat
include Concord::Public.new(:subject, :node)
CODE_DELIMITER = "\0".freeze
CODE_DELIMITER = "\0"
CODE_RANGE = (0..4).freeze
# Identification string
@ -86,7 +86,7 @@ module Mutant
# Evil mutation that should case mutations to fail tests
class Evil < self
SYMBOL = 'evil'.freeze
SYMBOL = 'evil'
TEST_PASS_SUCCESS = false
end # Evil
@ -94,7 +94,7 @@ module Mutant
# Neutral mutation that should not cause mutations to fail tests
class Neutral < self
SYMBOL = 'neutral'.freeze
SYMBOL = 'neutral'
TEST_PASS_SUCCESS = true
end # Neutral
@ -102,7 +102,7 @@ module Mutant
# Noop mutation, special case of neutral
class Noop < Neutral
SYMBOL = 'noop'.freeze
SYMBOL = 'noop'
TEST_PASS_SUCCESS = true
end # Noop

View File

@ -8,7 +8,7 @@ module Mutant
class Argument < self
handle(:arg, :kwarg)
UNDERSCORE = '_'.freeze
UNDERSCORE = '_'
children :name

View File

@ -10,7 +10,7 @@ module Mutant
handle(:regexp)
# No input can ever be matched with this
NULL_REGEXP_SOURCE = 'nomatch\A'.freeze
NULL_REGEXP_SOURCE = 'nomatch\A'
private

View File

@ -11,7 +11,7 @@ module Mutant
children :value
PREFIX = '__mutant__'.freeze
PREFIX = '__mutant__'
private

View File

@ -7,7 +7,7 @@ module Mutant
# Utility symbol mutator
class Symbol < self
POSTFIX = '__mutant__'.freeze
POSTFIX = '__mutant__'
private

View File

@ -97,7 +97,7 @@ module Mutant
class Framed < self
include anima.add(:tput)
BUFFER_FLAGS = 'a+'.freeze
BUFFER_FLAGS = 'a+'
REPORT_FREQUENCY = 20.0
REPORT_DELAY = 1 / REPORT_FREQUENCY

View File

@ -35,7 +35,7 @@ module Mutant
delegate :success?
NL = "\n".freeze
NL = "\n"
# Run printer
#

View File

@ -6,8 +6,8 @@ module Mutant
class Printer
# Printer for mutation progress results
class MutationProgressResult < self
SUCCESS = '.'.freeze
FAILURE = 'F'.freeze
SUCCESS = '.'
FAILURE = 'F'
# Run printer
#

View File

@ -9,8 +9,8 @@ module Mutant
delegate(:active_jobs, :payload)
ACTIVE_JOB_HEADER = 'Active Jobs:'.freeze
ACTIVE_JOB_FORMAT = '%d: %s'.freeze
ACTIVE_JOB_HEADER = 'Active Jobs:'
ACTIVE_JOB_FORMAT = '%d: %s'
# Print progress for collector
#

View File

@ -6,7 +6,7 @@ module Mutant
class Printer
# Reporter for progressive output format on scheduler Status objects
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(
:coverage,

View File

@ -6,7 +6,7 @@ module Mutant
class Printer
# Reporter for subject progress
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(
:tests,

View File

@ -9,9 +9,9 @@ module Mutant
delegate :tests, :runtime
STATUS_FORMAT = '- %d @ runtime: %s'.freeze
OUTPUT_HEADER = 'Test Output:'.freeze
TEST_FORMAT = ' - %s'.freeze
STATUS_FORMAT = '- %d @ runtime: %s'
OUTPUT_HEADER = 'Test Output:'
TEST_FORMAT = ' - %s'
# Run test result reporter
#

View File

@ -24,7 +24,7 @@ module Mutant
class Diff
include Adamantium, Anima.new(:config, :from, :to)
HEAD = 'HEAD'.freeze
HEAD = 'HEAD'
# Test if diff changes file at line range
#

View File

@ -7,7 +7,7 @@ module Mutant
class Instance < self
NAME_INDEX = 0
SYMBOL = '#'.freeze
SYMBOL = '#'
# Prepare subject for mutation insertion
#

View File

@ -7,7 +7,7 @@ module Mutant
class Singleton < self
NAME_INDEX = 1
SYMBOL = '.'.freeze
SYMBOL = '.'
# Prepare subject for mutation insertion
#

View File

@ -2,5 +2,5 @@
module Mutant
# Current mutant version
VERSION = '0.8.23'.freeze
VERSION = '0.8.23'
end # Mutant

View File

@ -14,7 +14,7 @@ module MutantSpec
# rubocop:disable MethodLength
module Corpus
TMP = ROOT.join('tmp').freeze
EXCLUDE_GLOB_FORMAT = '{%s}'.freeze
EXCLUDE_GLOB_FORMAT = '{%s}'
# Not in the docs. Number from chatting with their support.
# 2 processors allocated per container, 4 processes works well.
@ -27,9 +27,9 @@ module MutantSpec
class Project
MUTEX = Mutex.new
MUTATION_GENERATION_MESSAGE = 'Total Mutations/Time/Parse-Errors: %s/%0.2fs - %0.2f/s'.freeze
START_MESSAGE = 'Starting - %s'.freeze
FINISH_MESSAGE = 'Mutations - %4i - %s'.freeze
MUTATION_GENERATION_MESSAGE = 'Total Mutations/Time/Parse-Errors: %s/%0.2fs - %0.2f/s'
START_MESSAGE = 'Starting - %s'
FINISH_MESSAGE = 'Mutations - %4i - %s'
DEFAULT_MUTATION_COUNT = 0
@ -272,7 +272,7 @@ module MutantSpec
# Mapping of files which we expect to cause errors during mutation generation
class ErrorWhitelist
class UnnecessaryExpectation < StandardError
MESSAGE = 'Expected to encounter %s while mutating "%s"'.freeze
MESSAGE = 'Expected to encounter %s while mutating "%s"'
def initialize(*error_info)
super(MESSAGE % error_info)

View File

@ -14,7 +14,7 @@ module MutantSpec
end
class UnexpectedWarnings < StandardError
MSG = 'Unexpected warnings: %s'.freeze
MSG = 'Unexpected warnings: %s'
def initialize(warnings)
super(MSG % warnings.join("\n"))

View File

@ -3,7 +3,7 @@
RSpec.describe Mutant::Mutation do
let(:mutation_class) do
Class.new(Mutant::Mutation) do
const_set(:SYMBOL, 'test'.freeze)
const_set(:SYMBOL, 'test')
const_set(:TEST_PASS_SUCCESS, true)
end
end