scottwillson/racing_on_rails

View on GitHub
app/models/results/results_file.rb

Summary

Maintainability
A
3 hrs
Test Coverage

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

    def set_place(result, row)
      if result.numeric_place?
        result.place = result.numeric_place
        if race?(row) && result.place != 1
          import_warnings << "First racer #{row[:first_name]} #{row[:last_name]} should be first place racer. "
Severity: Minor
Found in app/models/results/results_file.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 result? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def result?(row)
      return false unless row
      return true if row[:place].present? || row[:number].present? || row[:license].present? || row[:team_name].present?
      return true unless row[:first_name].blank? && row[:last_name].blank? && row[:name].blank?

Severity: Minor
Found in app/models/results/results_file.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 assert_columns! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def assert_columns!(table)
      keys = table.columns.map(&:key)
      import_warnings << "No place column. Place is required." unless keys.include?(:place)

      unless keys.include?(:name) || (keys.include?(:first_name) && keys.include?(:lastname)) || keys.include?(:team_name)
Severity: Minor
Found in app/models/results/results_file.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 same_time? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.same_time?(row)
      return false unless row.previous
      return true if row[:time].blank?

      if row[:time].present?
Severity: Minor
Found in app/models/results/results_file.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 result_methods has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def result_methods(row, _race)
      attributes = row.to_hash.dup
      custom_attributes = {}
      attributes.delete_if do |key, value|
        _key = key.to_s.to_sym
Severity: Minor
Found in app/models/results/results_file.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