mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
rubocop: fix offences of the Style/FormatString cop
This commit is contained in:
parent
501e949921
commit
8ea5b6e0aa
5 changed files with 6 additions and 16 deletions
|
@ -239,17 +239,6 @@ Style/EvalWithLocation:
|
|||
- 'spec/commands/watch_expression_spec.rb'
|
||||
- 'spec/method_spec.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: format, sprintf, percent
|
||||
Style/FormatString:
|
||||
Exclude:
|
||||
- 'lib/pry/commands/gem_stats.rb'
|
||||
- 'lib/pry/commands/ls/local_vars.rb'
|
||||
- 'lib/pry/config/behavior.rb'
|
||||
- 'lib/pry/pry_class.rb'
|
||||
|
||||
# Offense count: 9
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: annotated, template, unannotated
|
||||
|
|
|
@ -65,14 +65,15 @@ VVVVVVVVVVVVVVVVVVVVV
|
|||
#{red('Dependencies')} (development)
|
||||
%{ddependencies}
|
||||
FORMAT
|
||||
format_str % {
|
||||
format(
|
||||
format_str,
|
||||
name: green(h.name),
|
||||
version: bold("v#{h.version}"),
|
||||
downloads: h.downloads,
|
||||
version_downloads: h.version_downloads,
|
||||
rdependencies: format_dependencies(h.dependencies.runtime),
|
||||
ddependencies: format_dependencies(h.dependencies.development)
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
def format_dependencies(rdeps)
|
||||
|
|
|
@ -31,7 +31,7 @@ class Pry
|
|||
colorized_lhs = color(:local_var, lhs)
|
||||
color_escape_padding = colorized_lhs.size - lhs.size
|
||||
pad = desired_width + color_escape_padding
|
||||
"%-#{pad}s = %s" % [color(:local_var, colorized_lhs), rhs]
|
||||
Kernel.format("%-#{pad}s = %s", color(:local_var, colorized_lhs), rhs)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -335,7 +335,7 @@ class Pry
|
|||
private
|
||||
|
||||
def __clip_inspect(obj)
|
||||
"#{obj.class}:0x%x" % obj.object_id
|
||||
format("#{obj.class}:0x%x", obj.object_id)
|
||||
end
|
||||
|
||||
def __try_convert_to_hash(obj)
|
||||
|
|
|
@ -247,7 +247,7 @@ you can add "Pry.config.windows_console_warning = false" to your pryrc.
|
|||
elsif Pry.config.prompt_safe_contexts.any? { |v| v === obj } && obj.inspect.length <= max
|
||||
obj.inspect
|
||||
else
|
||||
id == true ? "#<#{obj.class}:0x%x>" % (obj.object_id << 1) : "#<#{obj.class}>"
|
||||
id ? format("#<#{obj.class}:0x%x>", (obj.object_id << 1)) : "#<#{obj.class}>"
|
||||
end
|
||||
rescue RescuableException
|
||||
"unknown"
|
||||
|
|
Loading…
Reference in a new issue