Method run
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def run(options={})
max_items = options[:max_items]
max_time = options[:max_time]
current = 0
imported = 0
- 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
Class Import
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class Import < ApplicationRecord
has_many :items, :class_name => 'ImportItem', :dependent => :delete_all
belongs_to :user
serialize :settings
Method run
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run(options={})
max_items = options[:max_items]
max_time = options[:max_time]
current = 0
imported = 0
Method set_default_settings
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_default_settings(options={})
separator = lu(user, :general_csv_separator)
wrapper = '"'
encoding = lu(user, :general_csv_encoding)
if file_exists?
Method set_default_settings
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def set_default_settings(options={})
separator = lu(user, :general_csv_separator)
wrapper = '"'
encoding = lu(user, :general_csv_encoding)
if file_exists?
- 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 read_rows
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def read_rows
return unless file_exists?
csv_options = {:headers => false}
csv_options[:encoding] = settings['encoding'].to_s.presence || 'UTF-8'
- 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 read_items
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def read_items
i = 0
headers = true
read_rows do |row|
if i == 0 && headers
- 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_date
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def row_date(row, key)
if s = row_value(row, key)
format = settings['date_format']
format = DATE_FORMATS.first unless DATE_FORMATS.include?(format)
Date.strptime(s, format) rescue s
- 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 remove_file
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def remove_file
if file_exists?
begin
File.delete filepath
rescue => e
- 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"