app/workers/bulk_import_worker.rb
Method process_csv
has a Cognitive Complexity of 17 (exceeds 10 allowed). Consider refactoring. Open
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
- Read upRead up
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
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)
- Read upRead up
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"