Method csv_import
has a Cognitive Complexity of 96 (exceeds 5 allowed). Consider refactoring. Open
def csv_import(data)
try = data[:try].to_s == 'true'
delete = data[:delete].to_s == 'true'
begin
- 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 csv_example
has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring. Open
def csv_example(params = {})
header = []
records = where.not(id: csv_object_ids_ignored).offset(1).limit(23).to_a
if records.count < 20
record_ids = records.pluck(:id).concat(csv_object_ids_ignored)
- 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 csv_import
has 122 lines of code (exceeds 25 allowed). Consider refactoring. Open
def csv_import(data)
try = data[:try].to_s == 'true'
delete = data[:delete].to_s == 'true'
begin
File can_csv_import.rb
has 298 lines of code (exceeds 250 allowed). Consider refactoring. Open
module CanCsvImport
extend ActiveSupport::Concern
# methods defined here are going to extend the class, not the instance of it
class_methods do
Method csv_example
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def csv_example(params = {})
header = []
records = where.not(id: csv_object_ids_ignored).offset(1).limit(23).to_a
if records.count < 20
record_ids = records.pluck(:id).concat(csv_object_ids_ignored)
Method csv_verify_attributes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def csv_verify_attributes(clean_params)
all_clean_attributes = {}
new.attributes.each_key do |attribute|
all_clean_attributes[attribute.to_sym] = true
end
- 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"