From dcb8c4615033454138eb0a69b2d33a7c84b1ce3d Mon Sep 17 00:00:00 2001 From: Kyrylo Silin Date: Tue, 16 Oct 2018 04:49:13 +0800 Subject: [PATCH] rubocop: fix offences of the Lint/StringConversionInInterpolation --- .rubocop_todo.yml | 8 -------- lib/pry/command.rb | 2 +- lib/pry/commands/watch_expression.rb | 2 +- lib/pry/method/patcher.rb | 2 +- 4 files changed, 3 insertions(+), 11 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 9b9bb794..26fea174 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -636,14 +636,6 @@ Lint/ShadowedException: Exclude: - 'lib/pry/method.rb' -# Offense count: 4 -# Cop supports --auto-correct. -Lint/StringConversionInInterpolation: - Exclude: - - 'lib/pry/command.rb' - - 'lib/pry/commands/watch_expression.rb' - - 'lib/pry/method/patcher.rb' - # Offense count: 36 Lint/UnderscorePrefixedVariableName: Enabled: false diff --git a/lib/pry/command.rb b/lib/pry/command.rb index 6b0d9c13..5abd5555 100644 --- a/lib/pry/command.rb +++ b/lib/pry/command.rb @@ -212,7 +212,7 @@ class Pry $1.capitalize.gsub(/_/, " ") when %r{(pry-\w+)-([\d\.]+([\w\.]+)?)} name, version = $1, $2 - "#{name.to_s} (v#{version.to_s})" + "#{name} (v#{version})" when /pryrc/ "pryrc" else diff --git a/lib/pry/commands/watch_expression.rb b/lib/pry/commands/watch_expression.rb index 604164fc..bf165774 100644 --- a/lib/pry/commands/watch_expression.rb +++ b/lib/pry/commands/watch_expression.rb @@ -81,7 +81,7 @@ class Pry expressions.each do |expr| expr.eval! if expr.changed? - output.puts "#{blue "watch"}: #{expr.to_s}" + output.puts "#{blue "watch"}: #{expr}" end end end diff --git a/lib/pry/method/patcher.rb b/lib/pry/method/patcher.rb index 73ae263f..83360a5e 100644 --- a/lib/pry/method/patcher.rb +++ b/lib/pry/method/patcher.rb @@ -94,7 +94,7 @@ class Pry def wrap_for_owner(source) Pry.current[:pry_owner] = method.owner owner_source = definition_for_owner(source) - visibility_fix = "#{method.visibility.to_s} #{method.name.to_sym.inspect}" + visibility_fix = "#{method.visibility} #{method.name.to_sym.inspect}" "Pry.current[:pry_owner].class_eval do; #{owner_source}\n#{visibility_fix}\nend" end