rubinius/rubinius

View on GitHub
core/compiled_code.rb

Summary

Maintainability
D
2 days
Test Coverage

File compiled_code.rb has 421 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Rubinius
  class CompiledCode < Executable
    def self.allocate
      Rubinius.primitive :compiledcode_allocate
      raise PrimitiveFailure, "CompiledCode.allocate primitive failed"
Severity: Minor
Found in core/compiled_code.rb - About 6 hrs to fix

    Class CompiledCode has 40 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class CompiledCode < Executable
        def self.allocate
          Rubinius.primitive :compiledcode_allocate
          raise PrimitiveFailure, "CompiledCode.allocate primitive failed"
        end
    Severity: Minor
    Found in core/compiled_code.rb - About 5 hrs to fix

      Method first_ip_on_line has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def first_ip_on_line(line, start=nil)
            i = 1
            total = @lines.size
      
            while i < total
      Severity: Minor
      Found in core/compiled_code.rb - About 1 hr 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 add_metadata has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def add_metadata(key, val)
            raise TypeError, "key must be a symbol" unless key.kind_of? Symbol
      
            case val
            when true, false, Symbol, Fixnum, String
      Severity: Minor
      Found in core/compiled_code.rb - About 1 hr to fix

        Method locate_line has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def locate_line(line)
              i = 1
              total = @lines.size
              while i < total
                cur_line = @lines.at(i)
        Severity: Minor
        Found in core/compiled_code.rb - About 1 hr 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 parameters has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def parameters
              params = []
        
              return params unless respond_to?(:local_names)
        
        
        Severity: Minor
        Found in core/compiled_code.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 add_metadata has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def add_metadata(key, val)
              raise TypeError, "key must be a symbol" unless key.kind_of? Symbol
        
              case val
              when true, false, Symbol, Fixnum, String
        Severity: Minor
        Found in core/compiled_code.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 line_from_ip has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def line_from_ip(ip)
              return -1 unless @lines
              return 0 if @lines.size < 2
        
              low = 0
        Severity: Minor
        Found in core/compiled_code.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def initialize(inst, code, ip)
                @instruction = inst[0]
                @args = inst[1..-1]
                @comment = nil
        
        
        Severity: Minor
        Found in core/compiled_code.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