dougyouch/schema

View on GitHub
lib/schema/arrays.rb

Summary

Maintainability
C
7 hrs
Test Coverage
A
100%

Method update_attributes_with_array has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def update_attributes_with_array(array, mapped_headers, offset = nil)
      self.class.schema.each do |_, field_options|
        next unless (mapped_field = mapped_headers[field_options[:name]])

        if offset
Severity: Minor
Found in lib/schema/arrays.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 to_a has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def to_a
      data = []
      self.class.schema.each do |_, field_options|
        next if field_options[:alias_of]

Severity: Minor
Found in lib/schema/arrays.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 largest_number_of_indexes_from_map has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def largest_number_of_indexes_from_map(mapped_model)
      size = 0
      mapped_model.each do |_, info|
        if info[:indexes]
          size = info[:indexes].size if info[:indexes] && info[:indexes].size > size
Severity: Minor
Found in lib/schema/arrays.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 update_nested_has_one_associations_from_array has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def update_nested_has_one_associations_from_array(array, mapped_headers, current_offset = nil)
      self.class.schema.each do |_, field_options|
        next unless field_options[:type] == :has_one
        next unless (mapped_model = mapped_headers[field_options[:name]])

Severity: Minor
Found in lib/schema/arrays.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 update_nested_has_many_associations_from_array has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def update_nested_has_many_associations_from_array(array, mapped_headers)
      self.class.schema.each do |_, field_options|
        next unless field_options[:type] == :has_many
        next unless (mapped_model = mapped_headers[field_options[:name]])

Severity: Minor
Found in lib/schema/arrays.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

There are no issues that match your filters.

Category
Status