Muriel-Salvan/ruby-serial

Very complex method in #get_original_rec

          def get_original_rec(decoded_obj, container_to_fill = nil)
            if decoded_obj.is_a?(Array)
              if container_to_fill.nil?
                return decoded_obj.map { |serialized_item| get_original_rec(serialized_item) }
              else

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Very complex method in #get_msgpack_compatible_rec

          def get_msgpack_compatible_rec(obj, check_shared = true)
            if obj.is_a?(Fixnum) ||
               obj.is_a?(Bignum) ||
               obj.is_a?(Float) ||
               obj.nil? ||

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Complex method in #gather_ids_rec

          def gather_ids_rec(obj)
            if !obj.is_a?(Fixnum) &&
               !obj.is_a?(Bignum) &&
               !obj.is_a?(Float) &&
               !obj.is_a?(Symbol) &&

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Similar code found in 1 other location

# Add helper methods to Class.
# This way it is possible to declare which instance variables to be serialized at the Class level.
class Class

  attr_reader :dont_rubyserial_lst
Found in Class and 1 other location - About 3 hrs to fix
lib/ruby-serial/_class.rb on lines 12..16

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Refactorings

Further Reading

Similar code found in 1 other location

# Add helper methods to Class.
# This way it is possible to declare which instance variables to be serialized at the Class level.
class Class

  attr_reader :dont_rubyserial_lst
Found in Class and 1 other location - About 3 hrs to fix
lib/ruby-serial/_class.rb on lines 23..27

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Refactorings

Further Reading

Complex method in #instance_vars_to_be_rubyserialized

  def instance_vars_to_be_rubyserialized
    # Compute the list of attributes to serialize
    instance_var_names = []
    klass = self.class
    if !klass.rubyserial_only_lst.nil?
Found in Object - About 1 hr to fix

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Join us for Code Climate
Summit on July 19 in NYC.

Tickets on sale now.