Showing 107 of 109 total issues
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
Method call
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
def call(str, options = {})
custom_completions = options[:custom_completions] || []
# if there are multiple contexts e.g. cd 1/2/3
# get new target for 1/2 and find candidates for 3
path, input = build_path(str)
- 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
Class Command
has 48 methods (exceeds 20 allowed). Consider refactoring. Open
class Command
extend Helpers::DocumentationHelpers
extend CodeObject::Helpers
include Pry::Helpers::BaseHelpers
Method call
has 146 lines of code (exceeds 25 allowed). Consider refactoring. Open
def call(str, options = {})
custom_completions = options[:custom_completions] || []
# if there are multiple contexts e.g. cd 1/2/3
# get new target for 1/2 and find candidates for 3
path, input = build_path(str)
File pry_instance.rb
has 390 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'method_source'
require 'ostruct'
##
# Pry is a powerful alternative to the standard IRB shell for Ruby. It
Class Pry
has 40 methods (exceeds 20 allowed). Consider refactoring. Open
class Pry
extend Pry::Forwardable
attr_accessor :binding_stack
attr_accessor :custom_completions
File method.rb
has 385 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
Class Slop
has 36 methods (exceeds 20 allowed). Consider refactoring. Open
class Slop
require_relative 'slop/option'
require_relative 'slop/commands'
include Enumerable
VERSION = '3.4.0'.freeze
Method process_item
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def process_item(items, index, &block)
return unless (item = items[index])
option, argument = extract_option(item) if item.start_with?('-')
- 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
Class WrappedModule
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class WrappedModule
include Helpers::BaseHelpers
include CodeObject::Helpers
attr_reader :wrapped
File slop.rb
has 336 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Pry
# rubocop:disable Metrics/ClassLength
class Slop
require_relative 'slop/option'
require_relative 'slop/commands'
File command.rb
has 316 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'delegate'
require 'shellwords'
class Pry
# The super-class of all commands, new commands should be created by calling
Class Code
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class Code
class << self
include MethodSource::CodeHelpers
# Instantiate a `Code` object containing code loaded from a file or
Method indentation_delta
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def indentation_delta(tokens)
# We need to keep track of whether we've seen a "for" on this line because
# if the line ends with "do" then that "do" should be discounted (i.e. we're
# only opening one level not two) To do this robustly we want to keep track
# of the indent level at which we saw the for, so we can differentiate
- 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 format
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def format(mod, constants)
constants.sort_by(&:downcase).map do |name|
if Object.respond_to?(:deprecate_constant) &&
DEPRECATED_CONSTANTS.include?(name) &&
!show_deprecated_constants?
- 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
Class Pry
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Pry
LOCAL_RC_FILE = "./.pryrc".freeze
# @return [Boolean] true if this Ruby supports safe levels and tainting,
# to guard against using deprecated or unsupported features
Method handle_line
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def handle_line(line, options)
if line.nil?
config.control_d_handler.call(self)
return
end
- 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
Class Edit
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Edit < Pry::ClassCommand
match 'edit'
group 'Editing'
description 'Invoke the default editor on a file.'
Method resolve
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def resolve
scanner = StringScanner.new(@path_string.strip)
stack = @current_stack.dup
loop do
- 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 initialize
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize
merge!(
input: MemoizedValue.new { lazy_readline },
output: $stdout.tap { |out| out.sync = true },
commands: Pry::Commands,