1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Merge pull request #1801 from pry/rubocop-lint-unused-method-argument

rubocop: fix offences of the Lint/UnusedMethodArgument cop
This commit is contained in:
Kyrylo Silin 2018-10-14 15:58:34 +08:00 committed by GitHub
commit 13e9c39562
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 25 additions and 30 deletions

View file

@ -677,12 +677,6 @@ Lint/UnneededRequireStatement:
Lint/UnusedBlockArgument:
Enabled: false
# Offense count: 22
# Cop supports --auto-correct.
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
Lint/UnusedMethodArgument:
Enabled: false
# Offense count: 1
Lint/UselessAssignment:
Exclude:

View file

@ -297,9 +297,8 @@ class Pry
# Get the (approximate) Module.nesting at the give line number.
#
# @param [Integer] line_number line number starting from 1
# @param [Module] top_module the module in which this code exists
# @return [Array<Module>] a list of open modules.
def nesting_at(line_number, top_module = Object)
def nesting_at(line_number)
Pry::Indent.nesting_at(raw, line_number)
end

View file

@ -466,9 +466,9 @@ class Pry
# Generate completions for this command
#
# @param [String] search The line typed so far
# @param [String] _search The line typed so far
# @return [Array<String>] Completion words
def complete(search)
def complete(_search)
[]
end

View file

@ -19,16 +19,15 @@ class Pry
def process
raise CommandError, "No input to amend." if eval_string.empty?
eval_string.replace amended_input(eval_string)
eval_string.replace(amend_input)
run "fix-indent"
run "show-input"
end
private
# @param [String] string The string to amend.
# @return [String] A new string with the amendments applied to it.
def amended_input(string)
def amend_input
input_array = eval_string.each_line.to_a
if arg_string == "!"

View file

@ -10,7 +10,8 @@ class Pry
Import a Pry command set.
BANNER
def process(command_set_name)
# TODO: resolve unused parameter.
def process(_command_set_name)
raise CommandError, "Provide a command set name" if command_set.nil?
set = target.eval(arg_string)

View file

@ -38,7 +38,7 @@ class Pry
@pager.page(paging_text.string)
end
def formatter(io)
def formatter(_io)
if @formatter_klass
@formatter_klass.new
else

View file

@ -86,7 +86,9 @@ class Pry
end
end
def add_expression(arguments)
# TODO: fix arguments.
# https://github.com/pry/pry/commit/b031df2f2f5850ee6e9018f33d35f3485a9b0423
def add_expression(_arguments)
expressions << Expression.new(_pry_, target, arg_string)
output.puts "Watching #{Code.new(arg_string).highlighted}"
end

View file

@ -61,7 +61,7 @@ module Pry::Helpers::BaseHelpers
# Send the given text through the best available pager (if Pry.config.pager is
# enabled). Infers where to send the output if used as a mixin.
# DEPRECATED.
def stagger_output(text, out = nil)
def stagger_output(text, _out = nil)
if defined?(_pry_) && _pry_
_pry_.pager.page text
else

View file

@ -15,7 +15,7 @@ class Pry
end
# Ensure that duplicates have their @hooks object.
def initialize_copy(orig)
def initialize_copy(_orig)
hooks_dup = @hooks.dup
@hooks.each do |k, v|
hooks_dup[k] = v.dup

View file

@ -166,7 +166,7 @@ class Pry
# please use {all_from_obj} instead.
# the `method_type` argument is ignored.
#
def all_from_common(obj, method_type = nil, include_super=true)
def all_from_common(obj, _method_type = nil, include_super=true)
all_from_obj(obj, include_super)
end

View file

@ -20,7 +20,7 @@ class Pry
#
# @param [Object] receiver
# @param [String] method_name
def initialize(receiver, method_name, binding=nil)
def initialize(receiver, method_name)
@receiver, @name = receiver, method_name
@method = nil
end

View file

@ -8,7 +8,7 @@ class Pry
@name = name
end
def method_missing(*args)
def method_missing(*_args)
warn "Warning: The plugin '#{@name}' was not found! (no gem found)"
end
end

View file

@ -396,7 +396,7 @@ Readline version #{Readline::VERSION} detected - will not auto_resize! correctly
Thread.current[:pry_critical_section] > 0
end
def self.critical_section(&block)
def self.critical_section
Thread.current[:pry_critical_section] ||= 0
Thread.current[:pry_critical_section] += 1
yield

View file

@ -656,7 +656,7 @@ describe Pry::CommandSet do
end
it "should delegate to commands" do
@set.create_command('susan'){ def complete(search); ['--foo']; end }
@set.create_command('susan'){ def complete(_search); ['--foo']; end }
expect(@set.complete('susan ')).to eq ['--foo']
end
end

View file

@ -226,11 +226,11 @@ describe "Pry::Command" do
output.puts "setup"
end
def subcommands(cmd)
def subcommands(_cmd)
output.puts "subcommands"
end
def options(opt)
def options(_opt)
output.puts "options"
end

View file

@ -222,7 +222,7 @@ describe 'cd' do
end
it 'should cd into complex input (with spaces)' do
def @o.hello(x, y, z)
def @o.hello(_x, _y, _z)
:mon_ouie
end

View file

@ -47,7 +47,7 @@ describe "show-source" do
end
it "should find methods even if there are spaces in the arguments" do
def @o.foo(*bars)
def @o.foo(*_bars)
@foo = "Mr flibble"
self
end
@ -213,7 +213,7 @@ describe "show-source" do
describe "finding super methods with help of `--super` switch" do
before do
class Foo
def foo(*bars)
def foo(*_bars)
:super_wibble
end
end
@ -226,7 +226,7 @@ describe "show-source" do
it "finds super methods with explicit method argument" do
o = Foo.new
def o.foo(*bars)
def o.foo(*_bars)
:wibble
end

View file

@ -76,7 +76,7 @@ describe Pry do
# regression test for burg's bug (see git history)
it "Should not error when object doesn't have a valid == method" do
o = Object.new
def o.==(other)
def o.==(_other)
raise
end