sxross/MotionModel

View on GitHub
motion/model/formotion.rb

Summary

Maintainability
A
3 hrs
Test Coverage

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

    def to_formotion(form_title = nil, expose_auto_date_fields = false, first_section_title = nil)
      return new_to_formotion(form_title) if form_title.is_a? Hash

      @expose_auto_date_fields = expose_auto_date_fields

Severity: Minor
Found in motion/model/formotion.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 to_formotion has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def to_formotion(form_title = nil, expose_auto_date_fields = false, first_section_title = nil)
      return new_to_formotion(form_title) if form_title.is_a? Hash

      @expose_auto_date_fields = expose_auto_date_fields

Severity: Minor
Found in motion/model/formotion.rb - About 1 hr to fix

    Method from_formotion! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def from_formotion!(data)
          self.returnable_columns.each{|column|
            if data[column] && column_type(column) == :date || column_type(column) == :time
              data[column] = Time.at(data[column]) unless data[column].nil?
            end
    Severity: Minor
    Found in motion/model/formotion.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 fill_section has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def fill_section(section)
          new_section = {}
    
          section.each_pair do |key, value|
            case key
    Severity: Minor
    Found in motion/model/formotion.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

    There are no issues that match your filters.

    Category
    Status