From d069ca381bb359152bc0f0110c55d19291d08b1c Mon Sep 17 00:00:00 2001 From: Kyrylo Silin Date: Sun, 4 Nov 2018 16:42:25 +0800 Subject: [PATCH] rubocop: fix offences of the Layout/EmptyLinesAroundArguments cop --- .rubocop_todo.yml | 7 ------- lib/pry/indent.rb | 1 - spec/cli_spec.rb | 2 -- spec/code_object_spec.rb | 1 - spec/command_set_spec.rb | 1 - spec/command_spec.rb | 10 ---------- spec/commands/edit_spec.rb | 2 -- spec/commands/play_spec.rb | 1 - spec/commands/show_doc_spec.rb | 1 - spec/commands/show_source_spec.rb | 2 -- spec/commands/watch_expression_spec.rb | 1 - spec/commands/whereami_spec.rb | 1 - spec/completion_spec.rb | 3 --- spec/control_d_handler_spec.rb | 4 ---- spec/documentation_helper_spec.rb | 1 - spec/helpers/table_spec.rb | 1 - spec/hooks_spec.rb | 6 ------ spec/method/patcher_spec.rb | 1 - spec/method_spec.rb | 1 - spec/pry_defaults_spec.rb | 5 ----- spec/pry_spec.rb | 2 -- spec/sticky_locals_spec.rb | 2 -- spec/wrapped_module_spec.rb | 1 - 23 files changed, 57 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 7840373c..8f89429f 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -198,13 +198,6 @@ Layout/EmptyLinesAroundArguments: Exclude: - '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 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. diff --git a/lib/pry/indent.rb b/lib/pry/indent.rb index 49b0437a..dd533f9a 100644 --- a/lib/pry/indent.rb +++ b/lib/pry/indent.rb @@ -143,7 +143,6 @@ class Pry prefix = indent_level input.lines.each do |line| - if in_string? tokens = tokenize("#{open_delimiters_line}\n#{line}") tokens = tokens.drop_while{ |token, type| !(String === token && token.include?("\n")) } diff --git a/spec/cli_spec.rb b/spec/cli_spec.rb index 94699946..1d847349 100644 --- a/spec/cli_spec.rb +++ b/spec/cli_spec.rb @@ -51,7 +51,6 @@ describe Pry::Hooks do expect(run).to equal true expect(run2).to equal true end - end describe "processing options" do @@ -83,6 +82,5 @@ describe Pry::Hooks do expect(run).to eq true expect(run2).to eq true end - end end diff --git a/spec/code_object_spec.rb b/spec/code_object_spec.rb index 8c519255..3878a826 100644 --- a/spec/code_object_spec.rb +++ b/spec/code_object_spec.rb @@ -102,7 +102,6 @@ describe Pry::CodeObject do it 'finds nothing when passing nil as the first argument' do expect(Pry::CodeObject.lookup(nil, @p)).to eq nil end - end it 'should lookup instance methods defined on classes accessed via local variable' do diff --git a/spec/command_set_spec.rb b/spec/command_set_spec.rb index 82044d30..340e1ea4 100644 --- a/spec/command_set_spec.rb +++ b/spec/command_set_spec.rb @@ -579,7 +579,6 @@ describe Pry::CommandSet do end describe '.process_line' do - it 'should return Result.new(false) if there is no matching command' do result = @set.process_line('1 + 42') expect(result.command?).to eq false diff --git a/spec/command_spec.rb b/spec/command_spec.rb index 071474eb..1409aa0b 100644 --- a/spec/command_spec.rb +++ b/spec/command_spec.rb @@ -1,14 +1,12 @@ require_relative 'helper' describe "Pry::Command" do - before do @set = Pry::CommandSet.new @set.import Pry::Commands end describe 'call_safely' 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 # @@ -176,7 +174,6 @@ describe "Pry::Command" do end describe 'classy api' do - it 'should call setup, then subcommands, then options, then process' do cmd = @set.create_command 'rooster', "Has a tasty towel" do def setup @@ -237,7 +234,6 @@ describe "Pry::Command" do it 'should allow overriding options after definition' do cmd = @set.create_command(/number-(one|two)/, "Lieutenants of the Golgafrinchan Captain", shellwords: false) do - command_options listing: 'number-one' end @@ -369,7 +365,6 @@ describe "Pry::Command" do Pry.config.collision_warning = true cmd = @set.command '_frankie' do - end _frankie = 'boyle' @@ -386,7 +381,6 @@ describe "Pry::Command" do Pry.config.collision_warning = true cmd = @set.command 'frankie' do - end output = StringIO.new @@ -469,7 +463,6 @@ describe "Pry::Command" do end describe "block-related content removed from arguments" do - describe "arg_string" 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| @@ -643,7 +636,6 @@ describe "Pry::Command" do end describe "a command made with a custom sub-class" do - before do class MyTestCommand < Pry::ClassCommand match(/my-*test/) @@ -727,7 +719,6 @@ describe "Pry::Command" do end end end - end describe "commands can save state" do @@ -752,7 +743,6 @@ describe "Pry::Command" do state.my_state += 2 end end - end.import Pry::Commands @t = pry_tester(commands: @set) diff --git a/spec/commands/edit_spec.rb b/spec/commands/edit_spec.rb index 6421eec9..c9142f03 100644 --- a/spec/commands/edit_spec.rb +++ b/spec/commands/edit_spec.rb @@ -526,7 +526,6 @@ describe "edit" do expect(@file).to eq @tempfile_path expect(@line).to eq 14 - end it "should correctly find an instance method" do @@ -718,7 +717,6 @@ describe "edit" do end it "should change the alias, but not the original, without breaking super" do - $x = :bebe pry_eval 'edit -p X#c' diff --git a/spec/commands/play_spec.rb b/spec/commands/play_spec.rb index 00c64e1a..b7ce31c3 100644 --- a/spec/commands/play_spec.rb +++ b/spec/commands/play_spec.rb @@ -11,7 +11,6 @@ describe "play" do end describe "with an argument" do - # can't think of a f*cking way to test this!! describe "implied file" do # it 'should play from the file associated with the current binding' do diff --git a/spec/commands/show_doc_spec.rb b/spec/commands/show_doc_spec.rb index 1fc1e7c4..f294ccb8 100644 --- a/spec/commands/show_doc_spec.rb +++ b/spec/commands/show_doc_spec.rb @@ -11,7 +11,6 @@ describe "show-doc" do end def @o.no_docs;end - end after do diff --git a/spec/commands/show_source_spec.rb b/spec/commands/show_source_spec.rb index b3cf805c..4dff0ecb 100644 --- a/spec/commands/show_source_spec.rb +++ b/spec/commands/show_source_spec.rb @@ -223,7 +223,6 @@ describe "show-source" do end it "finds super methods with explicit method argument" do - o = Foo.new def o.foo(*_bars) :wibble @@ -455,7 +454,6 @@ describe "show-source" do end it 'should lookup module name with respect to current context' do - temporary_constants(:AlphaClass, :BetaClass) do class BetaClass def alpha diff --git a/spec/commands/watch_expression_spec.rb b/spec/commands/watch_expression_spec.rb index 28f7dcf4..6fac3206 100644 --- a/spec/commands/watch_expression_spec.rb +++ b/spec/commands/watch_expression_spec.rb @@ -1,7 +1,6 @@ require_relative '../helper' describe "watch expression" do - # Custom eval that will: # 1) Create an instance of pry that can use for multiple calls # 2) Exercise the after_eval hook diff --git a/spec/commands/whereami_spec.rb b/spec/commands/whereami_spec.rb index 1716bbc4..2ed626b8 100644 --- a/spec/commands/whereami_spec.rb +++ b/spec/commands/whereami_spec.rb @@ -248,5 +248,4 @@ describe "whereami" do it "should work inside an object" do expect(pry_eval(Object.new, 'whereami')).to match(/Inside # format" do o = Object.new @@ -333,11 +331,8 @@ describe "test Pry defaults" do expect(Pry.view_clip(m, DEFAULT_OPTIONS)).to eq m.name end end - end - end - end describe 'quiet' do diff --git a/spec/pry_spec.rb b/spec/pry_spec.rb index 01a1b8c0..12f7d3e4 100644 --- a/spec/pry_spec.rb +++ b/spec/pry_spec.rb @@ -72,7 +72,6 @@ describe Pry do end describe "Pry.binding_for" 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 @@ -379,7 +378,6 @@ describe Pry do end describe "Object#pry" do - after do Pry.reset_defaults Pry.config.color = false diff --git a/spec/sticky_locals_spec.rb b/spec/sticky_locals_spec.rb index 42007329..9418a09f 100644 --- a/spec/sticky_locals_spec.rb +++ b/spec/sticky_locals_spec.rb @@ -96,7 +96,6 @@ describe "Sticky locals (_file_ and friends)" do expect(o.instance_variable_get(:@value)).to eq :john Pry.config.extra_sticky_locals = {} end - end 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) end end - end diff --git a/spec/wrapped_module_spec.rb b/spec/wrapped_module_spec.rb index 2ec87402..e0520dc4 100644 --- a/spec/wrapped_module_spec.rb +++ b/spec/wrapped_module_spec.rb @@ -1,7 +1,6 @@ require_relative 'helper' describe Pry::WrappedModule do - describe "#initialize" do it "should raise an exception when a non-module is passed" do expect { Pry::WrappedModule.new(nil) }.to raise_error ArgumentError