mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
rubocop: fix offences of the Layout/EmptyLinesAroundArguments cop
This commit is contained in:
parent
372cbbdb15
commit
d069ca381b
23 changed files with 0 additions and 57 deletions
|
@ -198,13 +198,6 @@ Layout/EmptyLinesAroundArguments:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'spec/command_spec.rb'
|
- 'spec/command_spec.rb'
|
||||||
|
|
||||||
# Offense count: 53
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle.
|
|
||||||
# SupportedStyles: empty_lines, no_empty_lines
|
|
||||||
Layout/EmptyLinesAroundBlockBody:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 47
|
# Offense count: 47
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: EnforcedStyle.
|
# Configuration parameters: EnforcedStyle.
|
||||||
|
|
|
@ -143,7 +143,6 @@ class Pry
|
||||||
prefix = indent_level
|
prefix = indent_level
|
||||||
|
|
||||||
input.lines.each do |line|
|
input.lines.each do |line|
|
||||||
|
|
||||||
if in_string?
|
if in_string?
|
||||||
tokens = tokenize("#{open_delimiters_line}\n#{line}")
|
tokens = tokenize("#{open_delimiters_line}\n#{line}")
|
||||||
tokens = tokens.drop_while{ |token, type| !(String === token && token.include?("\n")) }
|
tokens = tokens.drop_while{ |token, type| !(String === token && token.include?("\n")) }
|
||||||
|
|
|
@ -51,7 +51,6 @@ describe Pry::Hooks do
|
||||||
expect(run).to equal true
|
expect(run).to equal true
|
||||||
expect(run2).to equal true
|
expect(run2).to equal true
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "processing options" do
|
describe "processing options" do
|
||||||
|
@ -83,6 +82,5 @@ describe Pry::Hooks do
|
||||||
expect(run).to eq true
|
expect(run).to eq true
|
||||||
expect(run2).to eq true
|
expect(run2).to eq true
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -102,7 +102,6 @@ describe Pry::CodeObject do
|
||||||
it 'finds nothing when passing nil as the first argument' do
|
it 'finds nothing when passing nil as the first argument' do
|
||||||
expect(Pry::CodeObject.lookup(nil, @p)).to eq nil
|
expect(Pry::CodeObject.lookup(nil, @p)).to eq nil
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should lookup instance methods defined on classes accessed via local variable' do
|
it 'should lookup instance methods defined on classes accessed via local variable' do
|
||||||
|
|
|
@ -579,7 +579,6 @@ describe Pry::CommandSet do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.process_line' do
|
describe '.process_line' do
|
||||||
|
|
||||||
it 'should return Result.new(false) if there is no matching command' do
|
it 'should return Result.new(false) if there is no matching command' do
|
||||||
result = @set.process_line('1 + 42')
|
result = @set.process_line('1 + 42')
|
||||||
expect(result.command?).to eq false
|
expect(result.command?).to eq false
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
|
|
||||||
describe "Pry::Command" do
|
describe "Pry::Command" do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
@set = Pry::CommandSet.new
|
@set = Pry::CommandSet.new
|
||||||
@set.import Pry::Commands
|
@set.import Pry::Commands
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'call_safely' do
|
describe 'call_safely' do
|
||||||
|
|
||||||
it 'should display a message if gems are missing' do
|
it 'should display a message if gems are missing' do
|
||||||
cmd = @set.create_command "ford-prefect", "From a planet near Beetlegeuse", requires_gem: %w(ghijkl) do
|
cmd = @set.create_command "ford-prefect", "From a planet near Beetlegeuse", requires_gem: %w(ghijkl) do
|
||||||
#
|
#
|
||||||
|
@ -176,7 +174,6 @@ describe "Pry::Command" do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'classy api' do
|
describe 'classy api' do
|
||||||
|
|
||||||
it 'should call setup, then subcommands, then options, then process' do
|
it 'should call setup, then subcommands, then options, then process' do
|
||||||
cmd = @set.create_command 'rooster', "Has a tasty towel" do
|
cmd = @set.create_command 'rooster', "Has a tasty towel" do
|
||||||
def setup
|
def setup
|
||||||
|
@ -237,7 +234,6 @@ describe "Pry::Command" do
|
||||||
|
|
||||||
it 'should allow overriding options after definition' do
|
it 'should allow overriding options after definition' do
|
||||||
cmd = @set.create_command(/number-(one|two)/, "Lieutenants of the Golgafrinchan Captain", shellwords: false) do
|
cmd = @set.create_command(/number-(one|two)/, "Lieutenants of the Golgafrinchan Captain", shellwords: false) do
|
||||||
|
|
||||||
command_options listing: 'number-one'
|
command_options listing: 'number-one'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -369,7 +365,6 @@ describe "Pry::Command" do
|
||||||
Pry.config.collision_warning = true
|
Pry.config.collision_warning = true
|
||||||
|
|
||||||
cmd = @set.command '_frankie' do
|
cmd = @set.command '_frankie' do
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
_frankie = 'boyle'
|
_frankie = 'boyle'
|
||||||
|
@ -386,7 +381,6 @@ describe "Pry::Command" do
|
||||||
Pry.config.collision_warning = true
|
Pry.config.collision_warning = true
|
||||||
|
|
||||||
cmd = @set.command 'frankie' do
|
cmd = @set.command 'frankie' do
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
output = StringIO.new
|
output = StringIO.new
|
||||||
|
@ -469,7 +463,6 @@ describe "Pry::Command" do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "block-related content removed from arguments" do
|
describe "block-related content removed from arguments" do
|
||||||
|
|
||||||
describe "arg_string" do
|
describe "arg_string" do
|
||||||
it 'should remove block-related content from arg_string (with one normal arg)' do
|
it 'should remove block-related content from arg_string (with one normal arg)' do
|
||||||
@set.block_command "walking-spanish", "down the hall", takes_block: true do |x, y|
|
@set.block_command "walking-spanish", "down the hall", takes_block: true do |x, y|
|
||||||
|
@ -643,7 +636,6 @@ describe "Pry::Command" do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "a command made with a custom sub-class" do
|
describe "a command made with a custom sub-class" do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
class MyTestCommand < Pry::ClassCommand
|
class MyTestCommand < Pry::ClassCommand
|
||||||
match(/my-*test/)
|
match(/my-*test/)
|
||||||
|
@ -727,7 +719,6 @@ describe "Pry::Command" do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "commands can save state" do
|
describe "commands can save state" do
|
||||||
|
@ -752,7 +743,6 @@ describe "Pry::Command" do
|
||||||
state.my_state += 2
|
state.my_state += 2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end.import Pry::Commands
|
end.import Pry::Commands
|
||||||
|
|
||||||
@t = pry_tester(commands: @set)
|
@t = pry_tester(commands: @set)
|
||||||
|
|
|
@ -526,7 +526,6 @@ describe "edit" do
|
||||||
|
|
||||||
expect(@file).to eq @tempfile_path
|
expect(@file).to eq @tempfile_path
|
||||||
expect(@line).to eq 14
|
expect(@line).to eq 14
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should correctly find an instance method" do
|
it "should correctly find an instance method" do
|
||||||
|
@ -718,7 +717,6 @@ describe "edit" do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should change the alias, but not the original, without breaking super" do
|
it "should change the alias, but not the original, without breaking super" do
|
||||||
|
|
||||||
$x = :bebe
|
$x = :bebe
|
||||||
pry_eval 'edit -p X#c'
|
pry_eval 'edit -p X#c'
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ describe "play" do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "with an argument" do
|
describe "with an argument" do
|
||||||
|
|
||||||
# can't think of a f*cking way to test this!!
|
# can't think of a f*cking way to test this!!
|
||||||
describe "implied file" do
|
describe "implied file" do
|
||||||
# it 'should play from the file associated with the current binding' do
|
# it 'should play from the file associated with the current binding' do
|
||||||
|
|
|
@ -11,7 +11,6 @@ describe "show-doc" do
|
||||||
end
|
end
|
||||||
|
|
||||||
def @o.no_docs;end
|
def @o.no_docs;end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
after do
|
after do
|
||||||
|
|
|
@ -223,7 +223,6 @@ describe "show-source" do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "finds super methods with explicit method argument" do
|
it "finds super methods with explicit method argument" do
|
||||||
|
|
||||||
o = Foo.new
|
o = Foo.new
|
||||||
def o.foo(*_bars)
|
def o.foo(*_bars)
|
||||||
:wibble
|
:wibble
|
||||||
|
@ -455,7 +454,6 @@ describe "show-source" do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should lookup module name with respect to current context' do
|
it 'should lookup module name with respect to current context' do
|
||||||
|
|
||||||
temporary_constants(:AlphaClass, :BetaClass) do
|
temporary_constants(:AlphaClass, :BetaClass) do
|
||||||
class BetaClass
|
class BetaClass
|
||||||
def alpha
|
def alpha
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
require_relative '../helper'
|
require_relative '../helper'
|
||||||
|
|
||||||
describe "watch expression" do
|
describe "watch expression" do
|
||||||
|
|
||||||
# Custom eval that will:
|
# Custom eval that will:
|
||||||
# 1) Create an instance of pry that can use for multiple calls
|
# 1) Create an instance of pry that can use for multiple calls
|
||||||
# 2) Exercise the after_eval hook
|
# 2) Exercise the after_eval hook
|
||||||
|
|
|
@ -248,5 +248,4 @@ describe "whereami" do
|
||||||
it "should work inside an object" do
|
it "should work inside an object" do
|
||||||
expect(pry_eval(Object.new, 'whereami')).to match(/Inside #<Object/)
|
expect(pry_eval(Object.new, 'whereami')).to match(/Inside #<Object/)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -58,11 +58,9 @@ describe Pry::InputCompleter do
|
||||||
# Complete class variables.
|
# Complete class variables.
|
||||||
b = Pry.binding_for(object.class)
|
b = Pry.binding_for(object.class)
|
||||||
completer_test(b).call('@@number', '@@number.class')
|
completer_test(b).call('@@number', '@@number.class')
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should complete for stdlib symbols' do
|
it 'should complete for stdlib symbols' do
|
||||||
|
|
||||||
o = Object.new
|
o = Object.new
|
||||||
# Regexp
|
# Regexp
|
||||||
completer_test(o).call('/foo/.extend')
|
completer_test(o).call('/foo/.extend')
|
||||||
|
@ -135,7 +133,6 @@ describe Pry::InputCompleter do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should complete for stdlib symbols' do
|
it 'should complete for stdlib symbols' do
|
||||||
|
|
||||||
o = Object.new
|
o = Object.new
|
||||||
# Regexp
|
# Regexp
|
||||||
completer_test(o).call('/foo/.extend')
|
completer_test(o).call('/foo/.extend')
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
|
|
||||||
describe Pry::DEFAULT_CONTROL_D_HANDLER do
|
describe Pry::DEFAULT_CONTROL_D_HANDLER do
|
||||||
|
|
||||||
describe "control-d press" do
|
describe "control-d press" do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
# Simulates a ^D press.
|
# Simulates a ^D press.
|
||||||
@control_d = "Pry::DEFAULT_CONTROL_D_HANDLER.call('', _pry_)"
|
@control_d = "Pry::DEFAULT_CONTROL_D_HANDLER.call('', _pry_)"
|
||||||
|
@ -56,7 +54,5 @@ describe Pry::DEFAULT_CONTROL_D_HANDLER do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -68,5 +68,4 @@ describe Pry::Helpers::DocumentationHelpers do
|
||||||
expect(@helper.process_rdoc("--\n comment in a bubble\n++")).to match(/\+\+/)
|
expect(@helper.process_rdoc("--\n comment in a bubble\n++")).to match(/\+\+/)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -89,7 +89,6 @@ asfadsssaaad fasfaafdssd s
|
||||||
|
|
||||||
it 'should not raise error' do
|
it 'should not raise error' do
|
||||||
expect { Pry::Helpers.tablify(@out, @elem_len - 1) }.not_to raise_error
|
expect { Pry::Helpers.tablify(@out, @elem_len - 1) }.not_to raise_error
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should format output as one column' do
|
it 'should format output as one column' do
|
||||||
|
|
|
@ -138,7 +138,6 @@ describe Pry::Hooks do
|
||||||
expect(h2.get_hook(:test_hook3, :testing)).to eq nil
|
expect(h2.get_hook(:test_hook3, :testing)).to eq nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -169,7 +168,6 @@ describe Pry::Hooks do
|
||||||
|
|
||||||
expect(hooks_dup.get_hook(:test_hook, :testing2)).not_to eq @hooks.get_hook(:test_hook, :testing2)
|
expect(hooks_dup.get_hook(:test_hook, :testing2)).not_to eq @hooks.get_hook(:test_hook, :testing2)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "getting hooks" do
|
describe "getting hooks" do
|
||||||
|
@ -323,7 +321,6 @@ describe Pry::Hooks do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "target" do
|
describe "target" do
|
||||||
|
|
||||||
it 'should yield the target, as a binding ' do
|
it 'should yield the target, as a binding ' do
|
||||||
b = nil
|
b = nil
|
||||||
Pry.config.hooks.add_hook(:when_started, :test_hook) { |target, opt, _| b = target }
|
Pry.config.hooks.add_hook(:when_started, :test_hook) { |target, opt, _| b = target }
|
||||||
|
@ -362,7 +359,6 @@ describe Pry::Hooks do
|
||||||
expect(o.value).to eq true
|
expect(o.value).to eq true
|
||||||
Pry.config.hooks.delete_hook(:when_started, :test_hook)
|
Pry.config.hooks.delete_hook(:when_started, :test_hook)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "after_session hook" do
|
describe "after_session hook" do
|
||||||
|
@ -423,7 +419,6 @@ describe Pry::Hooks do
|
||||||
expect(out.string).not_to match(/little_duck/)
|
expect(out.string).not_to match(/little_duck/)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "exceptions" do
|
describe "exceptions" do
|
||||||
|
@ -469,5 +464,4 @@ describe Pry::Hooks do
|
||||||
expect(x).to eq 2
|
expect(x).to eq 2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
require_relative '../helper'
|
require_relative '../helper'
|
||||||
|
|
||||||
describe Pry::Method::Patcher do
|
describe Pry::Method::Patcher do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
@x = Object.new
|
@x = Object.new
|
||||||
def @x.test; :before; end
|
def @x.test; :before; end
|
||||||
|
|
|
@ -437,7 +437,6 @@ describe Pry::Method do
|
||||||
def eigen_class(obj); class << obj; self; end; end
|
def eigen_class(obj); class << obj; self; end; end
|
||||||
|
|
||||||
it "should look at a class and then its superclass" do
|
it "should look at a class and then its superclass" do
|
||||||
|
|
||||||
expect(Pry::Method.instance_resolution_order(LS::Next)).to eq [LS::Next] + Pry::Method.instance_resolution_order(LS::Top)
|
expect(Pry::Method.instance_resolution_order(LS::Next)).to eq [LS::Next] + Pry::Method.instance_resolution_order(LS::Top)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,6 @@ describe "test Pry defaults" do
|
||||||
Pry.start(self, input: arity_multi_input, output: StringIO.new)
|
Pry.start(self, input: arity_multi_input, output: StringIO.new)
|
||||||
expect(arity_multi_input.prompt).to eq nil
|
expect(arity_multi_input.prompt).to eq nil
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should set the output default, and the default should be overridable' do
|
it 'should set the output default, and the default should be overridable' do
|
||||||
|
@ -288,7 +287,6 @@ describe "test Pry defaults" do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "given a regular object with an #inspect string longer than the maximum specified" do
|
describe "given a regular object with an #inspect string longer than the maximum specified" do
|
||||||
|
|
||||||
describe "when the object is a regular one" do
|
describe "when the object is a regular one" do
|
||||||
it "returns a string of the #<class name:object idish> format" do
|
it "returns a string of the #<class name:object idish> format" do
|
||||||
o = Object.new
|
o = Object.new
|
||||||
|
@ -333,11 +331,8 @@ describe "test Pry defaults" do
|
||||||
expect(Pry.view_clip(m, DEFAULT_OPTIONS)).to eq m.name
|
expect(Pry.view_clip(m, DEFAULT_OPTIONS)).to eq m.name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'quiet' do
|
describe 'quiet' do
|
||||||
|
|
|
@ -72,7 +72,6 @@ describe Pry do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "Pry.binding_for" do
|
describe "Pry.binding_for" do
|
||||||
|
|
||||||
# regression test for burg's bug (see git history)
|
# regression test for burg's bug (see git history)
|
||||||
it "Should not error when object doesn't have a valid == method" do
|
it "Should not error when object doesn't have a valid == method" do
|
||||||
o = Object.new
|
o = Object.new
|
||||||
|
@ -379,7 +378,6 @@ describe Pry do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "Object#pry" do
|
describe "Object#pry" do
|
||||||
|
|
||||||
after do
|
after do
|
||||||
Pry.reset_defaults
|
Pry.reset_defaults
|
||||||
Pry.config.color = false
|
Pry.config.color = false
|
||||||
|
|
|
@ -96,7 +96,6 @@ describe "Sticky locals (_file_ and friends)" do
|
||||||
expect(o.instance_variable_get(:@value)).to eq :john
|
expect(o.instance_variable_get(:@value)).to eq :john
|
||||||
Pry.config.extra_sticky_locals = {}
|
Pry.config.extra_sticky_locals = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "passing in as hash option when creating pry instance" do
|
describe "passing in as hash option when creating pry instance" do
|
||||||
|
@ -171,5 +170,4 @@ describe "Sticky locals (_file_ and friends)" do
|
||||||
expect(value1).not_to eq(value2)
|
expect(value1).not_to eq(value2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
|
|
||||||
describe Pry::WrappedModule do
|
describe Pry::WrappedModule do
|
||||||
|
|
||||||
describe "#initialize" do
|
describe "#initialize" do
|
||||||
it "should raise an exception when a non-module is passed" do
|
it "should raise an exception when a non-module is passed" do
|
||||||
expect { Pry::WrappedModule.new(nil) }.to raise_error ArgumentError
|
expect { Pry::WrappedModule.new(nil) }.to raise_error ArgumentError
|
||||||
|
|
Loading…
Reference in a new issue