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

rubocop: fix the Naming/ConstantName cop

This commit is contained in:
Kyrylo Silin 2019-03-24 18:17:18 +02:00
parent 030e74de3c
commit 1daa797da6
3 changed files with 16 additions and 22 deletions

View file

@ -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'

View file

@ -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

View file

@ -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