sxross/MotionModel

View on GitHub
motion/adapters/array_model_persistence.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method deserialize_from_file has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

      def deserialize_from_file(file_name = nil, directory = nil)
        if schema_version != '1.0.0'
          migrate
        end

Severity: Minor
Found in motion/adapters/array_model_persistence.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 deserialize_from_file has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def deserialize_from_file(file_name = nil, directory = nil)
        if schema_version != '1.0.0'
          migrate
        end

Severity: Minor
Found in motion/adapters/array_model_persistence.rb - About 1 hr to fix

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

        def encodeWithCoder(coder)
          columns.each do |attr|
            # Serialize attributes except the proxy has_many and belongs_to ones.
            unless [:belongs_to, :has_many, :has_one].include? column(attr).type
              value = self.send(attr)
    Severity: Minor
    Found in motion/adapters/array_model_persistence.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 initWithCoder has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def initWithCoder(coder)
          self.init
    
          new_tag_id = 1
          columns.each do |attr|
    Severity: Minor
    Found in motion/adapters/array_model_persistence.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