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

Merge pull request #1962 from pry/rubocop-lint-empty-when

rubocop: fix offences of the Lint/EmptyWhen cop
This commit is contained in:
Kyrylo Silin 2019-03-03 18:32:43 +02:00 committed by GitHub
commit f92e221bbc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 18 deletions

View file

@ -13,11 +13,6 @@ Gemspec/RequiredRubyVersion:
Exclude: Exclude:
- 'pry.gemspec' - 'pry.gemspec'
# Offense count: 2
Lint/EmptyWhen:
Exclude:
- 'lib/pry/input_completer.rb'
# Offense count: 6 # Offense count: 6
Lint/HandleExceptions: Lint/HandleExceptions:
Exclude: Exclude:

View file

@ -35,12 +35,6 @@ class Pry
yield yield
].freeze ].freeze
Operators = %w[
% & * ** + - /
< << <= <=> == === =~ > >= >>
[] []= ^ ! != !~
].freeze
WORD_ESCAPE_STR = " \t\n\"\\'`><=;|&{(".freeze WORD_ESCAPE_STR = " \t\n\"\\'`><=;|&{(".freeze
def initialize(input, pry = nil) def initialize(input, pry = nil)
@ -220,13 +214,9 @@ class Pry
def select_message(path, receiver, message, candidates) def select_message(path, receiver, message, candidates)
candidates.grep(/^#{message}/).collect do |e| candidates.grep(/^#{message}/).collect do |e|
case e next unless e =~ /^[a-zA-Z_]/
when /^[a-zA-Z_]/
path.call(receiver + "." << e) path.call(receiver + "." << e)
when /^[0-9]/
when *Operators
# receiver + " " << e
end
end.compact end.compact
end end