Add rubocop preference for String#%

This commit is contained in:
John Backus 2016-03-19 21:48:06 -07:00
parent c4dd8693cb
commit c08eeec7e2
6 changed files with 19 additions and 16 deletions

View file

@ -1,3 +1,3 @@
---
threshold: 18
total_score: 1172
total_score: 1168

View file

@ -67,7 +67,7 @@ MultilineOperationIndentation:
# Prefer String#% over Kernel#sprintf
FormatString:
Enabled: false
EnforcedStyle: percent
# Use square brackets for literal Array objects
PercentLiteralDelimiters:

View file

@ -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

View file

@ -2,6 +2,8 @@ module Mutant
class Reporter
class CLI
# CLI output format
#
# rubocop:disable FormatString
class Format
include AbstractType, Anima.new(:tty)

View file

@ -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

View file

@ -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