rubinius/rubinius

View on GitHub
core/exception.rb

Summary

Maintainability
D
1 day
Test Coverage

File exception.rb has 406 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class Exception
  attr_accessor :locations
  attr_accessor :cause
  attr_accessor :custom_backtrace

Severity: Minor
Found in core/exception.rb - About 5 hrs to fix

    Method new has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.new(*args)
        # This method is used 2 completely different ways. One is when it's called
        # on SystemCallError, in which case it tries to construct a Errno subclass
        # or makes a generic instead of itself.
        #
    Severity: Minor
    Found in core/exception.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 initialize has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

      def initialize(signo = nil, signm = nil)
        # MRI overrides this behavior just for SignalException itself
        # but not for anything that inherits from it, therefore we
        # need this ugly check to make sure it works as intented.
        return super(signo) unless self.class == SignalException
    Severity: Minor
    Found in core/exception.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 new has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def self.new(*args)
        # This method is used 2 completely different ways. One is when it's called
        # on SystemCallError, in which case it tries to construct a Errno subclass
        # or makes a generic instead of itself.
        #
    Severity: Minor
    Found in core/exception.rb - About 1 hr to fix

      Method set_backtrace has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def set_backtrace(bt)
          if bt.kind_of? Rubinius::Backtrace
            @backtrace = bt
          else
            # See if we stashed a Backtrace object away, and use it.
      Severity: Minor
      Found in core/exception.rb - About 55 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 from has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def self.from(message, column, line, code, file)
      Severity: Minor
      Found in core/exception.rb - About 35 mins to fix

        Method render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def render(header="An exception occurred", io=STDERR, color=true)
            exception = self
            exceptions = []
        
            while exception
        Severity: Minor
        Found in core/exception.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 message has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def message
            if @compiled_code
              if @ip and @ip >= 0
                "#{super} - at #{@compiled_code.name}+#{@ip}"
              else
        Severity: Minor
        Found in core/exception.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

        Method to_s has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def to_s
            if @given and @expected
              if @method_name
                "method '#{@method_name}': given #{@given}, expected #{@expected}"
              else
        Severity: Minor
        Found in core/exception.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