Showing 105 of 107 total issues
Class Whereami
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Whereami < Pry::ClassCommand
def initialize(*)
super
@method_code = nil
Class CommandSet
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class CommandSet
include Enumerable
include Pry::Helpers::BaseHelpers
attr_reader :helper_module
Method start
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def self.start(target = nil, options = {})
return if Pry::Env['DISABLE_PRY']
if Pry::Env['FAIL_PRY']
raise 'You have FAIL_PRY set to true, which results in Pry calls failing'
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
Method handle_line
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_line(line, options)
if line.nil?
config.control_d_handler.call(self)
return
end
Method parse!
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def parse!(items = ARGV, &block)
if items.empty? && @callbacks[:empty]
@callbacks[:empty].each { |cb| cb.call(self) }
return items
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
Method repl
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def repl
loop do
case val = read
when :control_c
output.puts ""
- 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 raise_up_common
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def raise_up_common(force, *args)
exception = if args == []
last_exception || RuntimeError.new
elsif args.length == 1 && args.first.is_a?(String)
RuntimeError.new(args.first)
- 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 to_s
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def to_s
heads = options.reject(&:tail?)
tails = (options - heads)
opts = (heads + tails).select(&:help).map(&:to_s)
optstr = opts.each_with_index.map do |o, i|
- 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 eval
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def eval(*strs)
reset_output
result = nil
strs.flatten.each do |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
Method indentation_delta
has 38 lines of code (exceeds 25 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
Method process
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process(spec)
unless spec
return output.puts(
"Please provide a class, module, or method name (e.g: ri Array#push)"
)
Method execute_option
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def execute_option(option, argument, index, item = nil)
unless option
if config[:multiple_switches] && strict?
raise InvalidOptionError, "Unknown option -#{item}"
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
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 process
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def process
@history = find_history
@history = @history.between(opts[:show]) if opts.present?(:show)
- 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 resolve
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def resolve
scanner = StringScanner.new(@path_string.strip)
stack = @current_stack.dup
loop do
Method extract_option
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def extract_option(flag)
option = fetch_option(flag)
option ||= fetch_option(flag.downcase) if config[:ignore_case]
option ||= fetch_option(flag.gsub(/([^-])-/, '\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 ignored_modules
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def ignored_modules
# We could cache the result, but IRB is not loaded by default.
# And this is very fast anyway.
# By using this approach, we avoid Module#name calls, which are
# relatively slow when there are a lot of anonymous modules defined.
- 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 show_result
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def show_result(result)
if last_result_is_exception?
exception_handler.call(output, result, self)
elsif should_print?
print.call(output, result, self)
- 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 30 lines of code (exceeds 25 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?