Class Method
has 50 methods (exceeds 20 allowed). Consider refactoring. Open
class Method # rubocop:disable Metrics/ClassLength
extend Helpers::BaseHelpers
extend Forwardable
include Helpers::BaseHelpers
File method.rb
has 384 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'method_source'
class Pry
class << self
# If the given object is a `Pry::Method`, return it unaltered. If it's
Method from_str
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def from_str(name, target = TOPLEVEL_BINDING, options = {})
if name.nil?
nil
elsif name.to_s =~ /(.+)\#(\S+)\Z/
context = Regexp.last_match(1)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method from_binding
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def from_binding(binding)
meth_name = binding.eval('::Kernel.__method__')
if [:__script__, nil].include?(meth_name)
nil
else
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method from_binding
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def from_binding(binding)
meth_name = binding.eval('::Kernel.__method__')
if [:__script__, nil].include?(meth_name)
nil
else
Method signature
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def signature
if respond_to?(:parameters)
args = parameters.inject([]) do |args_array, (arg_type, name)|
name ||= (arg_type == :block ? 'block' : "arg#{args_array.size + 1}")
args_array.push(
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method source_file
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def source_file
if source_location.nil?
if source_type == :c
info = pry_doc_info
info.file if info
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"