diff options
author | Kyrylo Silin <silin@kyrylo.org> | 2019-03-24 15:36:06 +0200 |
---|---|---|
committer | Kyrylo Silin <silin@kyrylo.org> | 2019-03-24 15:36:06 +0200 |
commit | 07de304553458884e38ae78c4a8854b6b21d9985 (patch) | |
tree | 8f8337343c2ec7072b706ea986c5f28b58484cda | |
parent | 5ceb7ff04a328ff0da1460feb7715be0fd7fcb5b (diff) | |
download | pry-07de304553458884e38ae78c4a8854b6b21d9985.tar.gz |
rubocop: fix Naming/HeredocDelimiterNaming cop
-rw-r--r-- | .rubocop_todo.yml | 17 | ||||
-rw-r--r-- | lib/pry/commands/easter_eggs.rb | 4 | ||||
-rw-r--r-- | lib/pry/commands/stat.rb | 4 | ||||
-rw-r--r-- | lib/pry/core_extensions.rb | 4 | ||||
-rw-r--r-- | lib/pry/pry_class.rb | 4 | ||||
-rw-r--r-- | spec/command_spec.rb | 8 | ||||
-rw-r--r-- | spec/commands/cat_spec.rb | 8 | ||||
-rw-r--r-- | spec/commands/edit_spec.rb | 4 | ||||
-rw-r--r-- | spec/commands/show_source_spec.rb | 8 | ||||
-rw-r--r-- | spec/commands/whereami_spec.rb | 8 | ||||
-rw-r--r-- | spec/helpers/table_spec.rb | 8 | ||||
-rw-r--r-- | spec/pry_repl_spec.rb | 4 |
12 files changed, 32 insertions, 49 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 4ef3b375..5e1ad010 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -85,23 +85,6 @@ Naming/HeredocDelimiterCase: Exclude: - 'spec/helpers/table_spec.rb' -# Offense count: 16 -# Configuration parameters: Blacklist. -# Blacklist: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$)) -Naming/HeredocDelimiterNaming: - Exclude: - - 'lib/pry/commands/easter_eggs.rb' - - 'lib/pry/commands/stat.rb' - - 'lib/pry/core_extensions.rb' - - 'lib/pry/pry_class.rb' - - 'spec/command_spec.rb' - - 'spec/commands/cat_spec.rb' - - 'spec/commands/edit_spec.rb' - - 'spec/commands/show_source_spec.rb' - - 'spec/commands/whereami_spec.rb' - - 'spec/helpers/table_spec.rb' - - 'spec/pry_repl_spec.rb' - # Offense count: 25 # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. # AllowedNames: io, id, to, by, on, in, at, ip, db diff --git a/lib/pry/commands/easter_eggs.rb b/lib/pry/commands/easter_eggs.rb index b081d772..b5883246 100644 --- a/lib/pry/commands/easter_eggs.rb +++ b/lib/pry/commands/easter_eggs.rb @@ -82,14 +82,14 @@ class Pry prev_color = pry_instance.config.color pry_instance.config.color = true - picture = unindent <<-'EOS'.gsub(/[[:alpha:]!]/) { |s| red(s) } + picture = unindent <<-'OUTPUT'.gsub(/[[:alpha:]!]/) { |s| red(s) } ____ _______________________ / \ | A W G | / O O \ | N I O N ! | | | | S S R I ! | \ \__/ / __| I K ! | \____/ \________________________| - EOS + OUTPUT move_up = if Helpers::Platform.windows_ansi? diff --git a/lib/pry/commands/stat.rb b/lib/pry/commands/stat.rb index cfdfabd2..2c22f32a 100644 --- a/lib/pry/commands/stat.rb +++ b/lib/pry/commands/stat.rb @@ -22,7 +22,7 @@ class Pry meth = method_object aliases = meth.aliases - output.puts unindent <<-EOS + output.puts(unindent(<<-OUTPUT)) Method Information: -- Name: #{meth.name} @@ -33,7 +33,7 @@ class Pry Arity: #{meth.arity} Method Signature: #{meth.signature} Source Location: #{meth.source_location ? meth.source_location.join(':') : 'Not found.'} - EOS + OUTPUT end end diff --git a/lib/pry/core_extensions.rb b/lib/pry/core_extensions.rb index 6800b0e5..7d10e3eb 100644 --- a/lib/pry/core_extensions.rb +++ b/lib/pry/core_extensions.rb @@ -124,7 +124,7 @@ class BasicObject # BasicObjects don't have respond_to?, so we just define the method # every time. As they also don't have `.freeze`, this call won't # fail as it can for normal Objects. - (class << self; self; end).class_eval <<-EOF, __FILE__, __LINE__ + 1 + (class << self; self; end).class_eval(<<-METHOD, __FILE__, __LINE__ + 1) # Get a binding with 'self' set to self, and no locals. # # The default definee is determined by the context in which the @@ -136,7 +136,7 @@ class BasicObject def __pry__ ::Kernel.binding end - EOF + METHOD __pry__ end end diff --git a/lib/pry/pry_class.rb b/lib/pry/pry_class.rb index 38c03f8d..44123790 100644 --- a/lib/pry/pry_class.rb +++ b/lib/pry/pry_class.rb @@ -325,11 +325,11 @@ you can add "Pry.config.windows_console_warning = false" to your pryrc. end if Readline::VERSION =~ /edit/i - warn <<-EOT + warn(<<-WARN) Readline version #{Readline::VERSION} detected - will not auto_resize! correctly. For the fix, use GNU Readline instead: https://github.com/guard/guard/wiki/Add-Readline-support-to-Ruby-on-Mac-OS-X - EOT + WARN return end diff --git a/spec/command_spec.rb b/spec/command_spec.rb index 185525bc..ab10c56f 100644 --- a/spec/command_spec.rb +++ b/spec/command_spec.rb @@ -422,11 +422,11 @@ describe "Pry::Command" do end it 'should accept multiline blocks' do - @t.eval <<-EOS + @t.eval <<-COMMAND walking-spanish | do :jesus end - EOS + COMMAND expect(@context.instance_variable_get(:@x)).to eq :jesus end @@ -595,11 +595,11 @@ describe "Pry::Command" do end end - @t.eval <<-EOS + @t.eval <<-COMMAND walking-spanish | do |x, y| [x, y] end - EOS + COMMAND expect(@context.instance_variable_get(:@x)).to eq [1, 2] end diff --git a/spec/commands/cat_spec.rb b/spec/commands/cat_spec.rb index 8ab7a30f..25a151d1 100644 --- a/spec/commands/cat_spec.rb +++ b/spec/commands/cat_spec.rb @@ -58,12 +58,12 @@ describe "cat" do @t.insert_nil_input # normally happens when a command is executed @t.eval ':hello' - expect(@t.eval('cat --in 1..3')).to eq unindent(<<-EOS) + expect(@t.eval('cat --in 1..3')).to eq(unindent(<<-RANGE)) 1: 10 3: :hello - EOS + RANGE end end @@ -78,13 +78,13 @@ describe "cat" do end it 'cat --ex should display repl code that generated exception' do - @t.eval unindent(<<-EOS) + @t.eval(unindent(<<-LAST_EXCEPTION)) begin this raises error rescue => e pry_instance.last_exception = e end - EOS + LAST_EXCEPTION expect(@t.eval('cat --ex')).to match(/\d+:(\s*) this raises error/) end diff --git a/spec/commands/edit_spec.rb b/spec/commands/edit_spec.rb index 7b2f57d3..114906f6 100644 --- a/spec/commands/edit_spec.rb +++ b/spec/commands/edit_spec.rb @@ -476,7 +476,7 @@ describe "edit" do Object.remove_const :X if defined? ::X Object.remove_const :A if defined? ::A @tempfile = Tempfile.new(['pry', '.rb']) - @tempfile.puts <<-EOS + @tempfile.puts(<<-CLASSES) module A def a :yup @@ -516,7 +516,7 @@ describe "edit" do end end end - EOS + CLASSES @tempfile.flush load @tempfile.path diff --git a/spec/commands/show_source_spec.rb b/spec/commands/show_source_spec.rb index 48942b15..13bb86e9 100644 --- a/spec/commands/show_source_spec.rb +++ b/spec/commands/show_source_spec.rb @@ -325,7 +325,7 @@ describe "show-source" do describe "on variables that shadow methods" do before do - @t = pry_tester.eval unindent(<<-EOS) + @t = pry_tester.eval(unindent(<<-SHADOWED_VAR)) class ::TestHost def hello hello = proc { ' smile ' } @@ -334,7 +334,7 @@ describe "show-source" do end end ::TestHost.new.hello - EOS + SHADOWED_VAR end after do @@ -456,7 +456,7 @@ describe "show-source" do end before do - pry_eval unindent(<<-EOS) + pry_eval(unindent(<<-CLASSES)) class Dog def woof end @@ -466,7 +466,7 @@ describe "show-source" do def woof end end - EOS + CLASSES end after do diff --git a/spec/commands/whereami_spec.rb b/spec/commands/whereami_spec.rb index be87a3f9..1ccac2ef 100644 --- a/spec/commands/whereami_spec.rb +++ b/spec/commands/whereami_spec.rb @@ -80,9 +80,9 @@ describe "whereami" do ) do class Cor def blimey! - eval <<-END, binding, "spec/fixtures/example.erb", 1 + eval(<<-WHEREAMI, binding, 'spec/fixtures/example.erb', 1) pry_eval(binding, 'whereami') - END + WHEREAMI end end @@ -96,11 +96,11 @@ describe "whereami" do 'would raise an error' ) do class Cor - eval <<-END, binding, "spec/fixtures/example.erb", 1 + eval <<-WHEREAMI, binding, "spec/fixtures/example.erb", 1 def blimey! pry_eval(binding, 'whereami') end - END + WHEREAMI end expect { Cor.instance_method(:blimey!).source } diff --git a/spec/helpers/table_spec.rb b/spec/helpers/table_spec.rb index c35e6ad9..be243460 100644 --- a/spec/helpers/table_spec.rb +++ b/spec/helpers/table_spec.rb @@ -47,7 +47,7 @@ assfsafsfsds fsasa ssdsssafsdasdf end it 'should handle... another basic case' do - try_round_trip(<<-EOT) + try_round_trip(<<-TABLE) aaad dasaasffaasf fdasfdfss safdfdddsasd aaadfasassdfff ddadadassasdf fddsasadfssdss sasf aaddaafaf dddasaaaaaa fdsasad sddsa @@ -56,14 +56,14 @@ adasadfaaffds dsfafdsfdfssda ffadsfafsaafa ss asddaadaaadfdd dssdss ffssfsfafaadss ssas asdsdaa faadf fsddfff ssdfssff asfadsssaaad fasfaafdssd s - EOT + TABLE end it 'should handle colors' do - try_round_trip(<<-EOT) + try_round_trip(<<-TABLE) \e[31maaaaaaaaaa\e[0m \e[31mccccccccccccccccccccccccccccc\e[0m \e[31mbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\e[0m \e[31mddddddddddddd\e[0m - EOT + TABLE end it 'should handle empty input' do diff --git a/spec/pry_repl_spec.rb b/spec/pry_repl_spec.rb index 6145226e..5430a0a7 100644 --- a/spec/pry_repl_spec.rb +++ b/spec/pry_repl_spec.rb @@ -128,11 +128,11 @@ describe Pry::REPL do def output.tty? true end - input <<EOS + input <<TAB loop do break #note the tab here end -EOS +TAB output("do\n break #note the tab here\nend\n\e[1B\e[0G=> nil") end end |