diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 01fb0c2f..f4d09cf3 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -71,9 +71,3 @@ Naming/AccessorMethodName: Naming/BinaryOperatorParameterName: Exclude: - 'lib/pry/method.rb' - -# Offense count: 5 -Naming/ConstantName: - Exclude: - - 'lib/pry/input_completer.rb' - - 'spec/completion_spec.rb' diff --git a/lib/pry/input_completer.rb b/lib/pry/input_completer.rb index 7ff93030..1b54613d 100644 --- a/lib/pry/input_completer.rb +++ b/lib/pry/input_completer.rb @@ -15,7 +15,7 @@ class Pry GLOBALVARIABLE_REGEXP = /^(\$[^.]*)$/.freeze VARIABLE_REGEXP = /^([^."].*)\.([^.]*)$/.freeze - ReservedWords = %w[ + RESERVED_WORDS = %w[ BEGIN END alias and begin break @@ -214,7 +214,7 @@ class Pry ).collect(&:to_s) end candidates = - (candidates | ReservedWords | custom_completions) + (candidates | RESERVED_WORDS | custom_completions) .grep(/^#{Regexp.quote(input)}/) candidates.collect(&path) end diff --git a/spec/completion_spec.rb b/spec/completion_spec.rb index dc2ea38d..4216ea74 100644 --- a/spec/completion_spec.rb +++ b/spec/completion_spec.rb @@ -99,16 +99,16 @@ describe Pry::InputCompleter do # Constant module Mod - remove_const :Con if defined? Con - Con = 'Constant'.freeze + remove_const :CON if defined? CON + CON = 'Constant'.freeze module Mod2 end end - completer_test(Mod).call('Con') + completer_test(Mod).call('CON') # Constants or Class Methods - completer_test(o).call('Mod::Con') + completer_test(o).call('Mod::CON') # Symbol _foo = :symbol @@ -132,10 +132,10 @@ describe Pry::InputCompleter do end module Baz - remove_const :Con if defined? Con + remove_const :CON if defined? CON @bar = Bar @bazvar = :baz - Con = :constant + CON = :constant end pry = Pry.new(target: Baz) @@ -143,7 +143,7 @@ describe Pry::InputCompleter do b = Pry.binding_for(Bar) completer_test(b, pry).call("../@bazvar") - completer_test(b, pry).call('/Con') + completer_test(b, pry).call('/CON') end it 'should complete for stdlib symbols' do @@ -172,16 +172,16 @@ describe Pry::InputCompleter do # Constant module Mod - remove_const :Con if defined? Con - Con = 'Constant'.freeze + remove_const :CON if defined? CON + CON = 'Constant'.freeze module Mod2 end end - completer_test(Mod).call('Con') + completer_test(Mod).call('CON') # Constants or Class Methods - completer_test(o).call('Mod::Con') + completer_test(o).call('Mod::CON') # Symbol _foo = :symbol @@ -205,10 +205,10 @@ describe Pry::InputCompleter do end module Baz - remove_const :Con if defined? Con + remove_const :CON if defined? CON @bar = Bar @bazvar = :baz - Con = :constant + CON = :constant end pry = Pry.new(target: Baz) @@ -216,7 +216,7 @@ describe Pry::InputCompleter do b = Pry.binding_for(Bar) completer_test(b, pry).call("../@bazvar") - completer_test(b, pry).call('/Con') + completer_test(b, pry).call('/CON') end it 'should not return nil in its output' do