diff --git a/config/flay.yml b/config/flay.yml index bdea6a8b..aaff9513 100644 --- a/config/flay.yml +++ b/config/flay.yml @@ -1,3 +1,3 @@ --- threshold: 18 -total_score: 1172 +total_score: 1168 diff --git a/config/rubocop.yml b/config/rubocop.yml index e44a2050..64d93f50 100644 --- a/config/rubocop.yml +++ b/config/rubocop.yml @@ -67,7 +67,7 @@ MultilineOperationIndentation: # Prefer String#% over Kernel#sprintf FormatString: - Enabled: false + EnforcedStyle: percent # Use square brackets for literal Array objects PercentLiteralDelimiters: diff --git a/lib/mutant/matcher/method/singleton.rb b/lib/mutant/matcher/method/singleton.rb index 51c274c1..4d5d2d59 100644 --- a/lib/mutant/matcher/method/singleton.rb +++ b/lib/mutant/matcher/method/singleton.rb @@ -16,9 +16,10 @@ module Mutant # Singleton method evaluator class Evaluator < Evaluator - SUBJECT_CLASS = Subject::Method::Singleton - RECEIVER_INDEX = 0 - NAME_INDEX = 1 + 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 private @@ -65,7 +66,7 @@ module Mutant when :const receiver_name?(receiver) else - env.warn(format('Can only match :defs on :self or :const got %s unable to match', receiver.type.inspect)) + env.warn(RECEIVER_WARNING % receiver.type) nil end end diff --git a/lib/mutant/reporter/cli/format.rb b/lib/mutant/reporter/cli/format.rb index ba480adc..533ec8bf 100644 --- a/lib/mutant/reporter/cli/format.rb +++ b/lib/mutant/reporter/cli/format.rb @@ -2,6 +2,8 @@ module Mutant class Reporter class CLI # CLI output format + # + # rubocop:disable FormatString class Format include AbstractType, Anima.new(:tty) diff --git a/lib/mutant/reporter/cli/printer.rb b/lib/mutant/reporter/cli/printer.rb index fd5ec776..04716829 100644 --- a/lib/mutant/reporter/cli/printer.rb +++ b/lib/mutant/reporter/cli/printer.rb @@ -75,14 +75,14 @@ module Mutant # # @return [undefined] def info(string, *arguments) - puts(format(string, *arguments)) + puts(string % arguments) end # Print a status line to output # # @return [undefined] def status(string, *arguments) - puts(colorize(status_color, format(string, *arguments))) + puts(colorize(status_color, string % arguments)) end # Print a line to output diff --git a/spec/support/corpus.rb b/spec/support/corpus.rb index 68dd3945..3a5c0a80 100644 --- a/spec/support/corpus.rb +++ b/spec/support/corpus.rb @@ -24,6 +24,11 @@ module MutantSpec # rubocop:disable ClassLength 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 + include Adamantium, Anima.new( :exclude, :expect_coverage, @@ -91,12 +96,7 @@ module MutantSpec count end.inject(0, :+) took = Time.now - start - puts format( - 'Total Mutations/Time/Parse-Errors: %s/%0.2fs - %0.2f/s', - total, - took, - total / took - ) + puts MUTATION_GENERATION_MESSAGE % [total, took, total / took] self end @@ -193,7 +193,7 @@ module MutantSpec # def start(path, _index) MUTEX.synchronize do - puts format('Starting - %s', path) + puts START_MESSAGE % path end end @@ -207,7 +207,7 @@ module MutantSpec # def finish(path, _index, count) MUTEX.synchronize do - puts format('Mutations - %4i - %s', count, path) + puts FINISH_MESSAGE % [count, path] end end