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

rubocop: fix offences of the Style/Alias cop

This commit is contained in:
Kyrylo Silin 2019-02-27 01:00:16 +02:00
parent 218fac79b7
commit fad7827ddb
7 changed files with 19 additions and 32 deletions

View file

@ -192,19 +192,6 @@ Style/AccessModifierDeclarations:
- 'spec/helper.rb'
- 'spec/method/patcher_spec.rb'
# Offense count: 19
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: prefer_alias, prefer_alias_method
Style/Alias:
Exclude:
- 'lib/pry/command.rb'
- 'lib/pry/command_set.rb'
- 'lib/pry/config/behavior.rb'
- 'lib/pry/wrapped_module.rb'
- 'lib/pry/wrapped_module/candidate.rb'
- 'spec/method_spec.rb'
# Offense count: 2
# Configuration parameters: AllowedChars.
Style/AsciiComments:

View file

@ -45,8 +45,8 @@ class Pry
@command_options
end
# backward compatibility
alias_method :options, :command_options
alias_method :options=, :command_options=
alias options command_options
alias options= command_options=
# Define or get the command's banner
def banner(arg = nil)
@ -70,12 +70,12 @@ class Pry
def source_file
Array(block.source_location).first
end
alias_method :file, :source_file
alias file source_file
def source_line
Array(block.source_location).last
end
alias_method :line, :source_line
alias line source_line
def default_options(match)
{
@ -514,7 +514,7 @@ WARN
# Create subclasses using {Pry::CommandSet#command}.
class BlockCommand < Command
# backwards compatibility
alias_method :opts, :context
alias opts context
# Call the block that was registered with this command.
# @param [Array<String>] args The arguments passed
@ -564,12 +564,12 @@ WARN
def source_file
source_object.source_file
end
alias_method :file, :source_file
alias file source_file
def source_line
source_object.source_line
end
alias_method :line, :source_line
alias line source_line
private

View file

@ -81,7 +81,7 @@ class Pry
@commands[match] = Pry::BlockCommand.subclass(match, description, options, helper_module, &block)
end
alias_method :command, :block_command
alias command block_command
# Defines a new Pry command class.
#
@ -275,12 +275,12 @@ class Pry
def list_commands
@commands.keys
end
alias_method :keys, :list_commands
alias keys list_commands
def to_hash
@commands.dup
end
alias_method :to_h, :to_hash
alias to_h to_hash
# Find a command that matches the given line
# @param [String] pattern The line that might be a command invocation
@ -292,7 +292,7 @@ class Pry
command.match_score(pattern)
end
end
alias_method :find_command, :[]
alias find_command []
#
# Re-assign the command found at _pattern_ with _command_.

View file

@ -226,7 +226,7 @@ class Pry
@lookup == __try_convert_to_hash(other)
end
alias_method :eql?, :==
alias eql? ==
#
# @example
@ -303,7 +303,7 @@ class Pry
def to_hash
@lookup.dup
end
alias_method :to_h, :to_hash
alias to_h to_hash
def inspect
key_str = keys.map { |key| "'#{key}'" }.join(",")

View file

@ -169,14 +169,14 @@ class Pry
def file
Array(source_location).first
end
alias_method :source_file, :file
alias source_file file
# @return [Fixnum, nil] The associated line for the module (i.e
# the primary candidate: highest ranked monkeypatch).
def line
Array(source_location).last
end
alias_method :source_line, :line
alias source_line line
# Returns documentation for the module.
# This documentation is for the primary candidate, if

View file

@ -12,11 +12,11 @@ class Pry
# @return [String] The file where the module definition is located.
attr_reader :file
alias_method :source_file, :file
alias source_file file
# @return [Fixnum] The line where the module definition is located.
attr_reader :line
alias_method :source_line, :line
alias source_line line
# Methods to delegate to associated `Pry::WrappedModule
# instance`.

View file

@ -186,7 +186,7 @@ describe Pry::Method do
@nips = "nips"
binding
end
alias paella borscht
alias_method :paella, :borscht
def borscht() paella end
end
@ -511,7 +511,7 @@ describe Pry::Method do
def eat
end
alias fress eat
alias_method :fress, :eat
alias_method :omnomnom, :fress
def eruct