bikeindex/bike_index

View on GitHub
app/workers/bulk_import_worker.rb

Summary

Maintainability
A
2 hrs
Test Coverage
A
100%

Method process_csv has a Cognitive Complexity of 17 (exceeds 10 allowed). Consider refactoring.
Open

  def process_csv(open_file)
    @line_errors = @bulk_import.line_errors || [] # We always need line_errors
    return false if @bulk_import.finished? # If url fails to load, this will catch

    # Grab the first line of the csv (which is the header line) and transform it
Severity: Minor
Found in app/workers/bulk_import_worker.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 row_to_b_param_hash has a Cognitive Complexity of 17 (exceeds 10 allowed). Consider refactoring.
Open

  def row_to_b_param_hash(row_with_whitespaces)
    # remove whitespace from the values in the row
    row = row_with_whitespaces.map { |k, v|
      next [k, v] unless v.is_a?(String)

Severity: Minor
Found in app/workers/bulk_import_worker.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

There are no issues that match your filters.

Category
Status