rubinius/rubinius

View on GitHub
core/marshal.rb

Summary

Maintainability
F
5 days
Test Coverage

File marshal.rb has 970 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class BasicObject
  def __marshal__(ms, strip_ivars = false)
    out = ms.serialize_extended_object self
    out << "o"
    cls = Rubinius::Type.object_class self
Severity: Major
Found in core/marshal.rb - About 2 days to fix

    Class State has 45 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class State
    
        def initialize(stream, depth, proc)
          # shared
          @links = Rubinius::LookupTable.new
    Severity: Minor
    Found in core/marshal.rb - About 6 hrs to fix

      Method construct has 78 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def construct(ivar_index = nil, call_proc = true)
            type = consume_byte()
            obj = case type
                  when 48   # ?0
                    nil
      Severity: Major
      Found in core/marshal.rb - About 3 hrs to fix

        Method __marshal__ has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

          def __marshal__(ms)
            if nan?
              str = "nan"
            elsif zero?
              str = (1.0 / self) < 0 ? '-0' : '0'
        Severity: Minor
        Found in core/marshal.rb - About 3 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 construct has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            def construct(ivar_index = nil, call_proc = true)
              type = consume_byte()
              obj = case type
                    when 48   # ?0
                      nil
        Severity: Minor
        Found in core/marshal.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 serialize_fixnum has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def serialize_fixnum(n)
              if n == 0
                s = n.chr
              elsif n > 0 and n < 123
                s = (n + 5).chr
        Severity: Minor
        Found in core/marshal.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 set_instance_variables has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def set_instance_variables(obj)
              construct_integer.times do
                ivar = get_symbol
                value = construct
        
        
        Severity: Minor
        Found in core/marshal.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 construct_integer has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def construct_integer
              c = consume_byte()
        
              # The format appears to be a simple integer compression format
              #
        Severity: Minor
        Found in core/marshal.rb - About 1 hr to fix

          Method __marshal__ has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def __marshal__(ms)
              if nan?
                str = "nan"
              elsif zero?
                str = (1.0 / self) < 0 ? '-0' : '0'
          Severity: Minor
          Found in core/marshal.rb - About 1 hr to fix

            Method __custom_marshal__ has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def __custom_marshal__(ms)
                out = Rubinius::Type.binary_string("")
            
                # Order matters.
                extra_values = {}
            Severity: Minor
            Found in core/marshal.rb - About 1 hr to fix

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

                def self.dump(obj, an_io=nil, limit=nil)
                  unless limit
                    if Rubinius::Type.object_kind_of? an_io, Fixnum
                      limit = an_io
                      an_io = nil
              Severity: Minor
              Found in core/marshal.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 serialize_instance_variables_suffix has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def serialize_instance_variables_suffix(obj, force=false,
                                                          strip_ivars=false,
                                                          exclude_ivars=false)
                    ivars = serializable_instance_variables(obj, exclude_ivars)
              
              
              Severity: Minor
              Found in core/marshal.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 __marshal__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                def __marshal__(ms)
                  raise TypeError, "can't dump hash with default proc" if default_proc
              
                  excluded_ivars = %w[
                    @head @tail @size @previous @next @key @key_hash @value
              Severity: Minor
              Found in core/marshal.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 serialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def serialize(obj)
                    raise ArgumentError, "exceed depth limit" if @depth == 0
              
                    # How much depth we have left.
                    @depth -= 1;
              Severity: Minor
              Found in core/marshal.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 serialize_symbol has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def serialize_symbol(obj)
                    str = obj.to_s
                    mf = "I" unless str.ascii_only?
                    if mf
                      if Rubinius::Type.object_encoding(obj).equal? Encoding::BINARY
              Severity: Minor
              Found in core/marshal.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 load has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.load(obj, prc = nil)
                  if Rubinius::Type.object_respond_to? obj, :to_str
                    data = obj.to_s
              
                    major = data.getbyte 0
              Severity: Minor
              Found in core/marshal.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