lib/pry/pry_class.rb

Summary

Maintainability
C
1 day
Test Coverage

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
Severity: Minor
Found in lib/pry/pry_class.rb - About 3 hrs to fix

    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
    Severity: Minor
    Found in lib/pry/pry_class.rb - About 2 hrs to fix

    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 start has 30 lines of code (exceeds 25 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
    Severity: Minor
    Found in lib/pry/pry_class.rb - About 1 hr to fix

      Method view_clip has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.view_clip(obj, options = {})
          max = options.fetch :max_length, 60
          id = options.fetch :id, false
          if obj.is_a?(Module) && obj.name.to_s != "" && obj.name.to_s.length <= max
            obj.name.to_s
      Severity: Minor
      Found in lib/pry/pry_class.rb - About 45 mins to fix

      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 auto_resize! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.auto_resize!
          Pry.config.input # by default, load Readline
      
          if !defined?(Readline) || Pry.config.input != Readline
            warn "Sorry, you must be using Readline for Pry.auto_resize! to work."
      Severity: Minor
      Found in lib/pry/pry_class.rb - About 35 mins to fix

      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 final_session_setup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.final_session_setup
          return if @session_finalized
      
          @session_finalized = true
          load_requires if Pry.config.should_load_requires
      Severity: Minor
      Found in lib/pry/pry_class.rb - About 25 mins to fix

      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

      There are no issues that match your filters.

      Category
      Status