Showing 67 of 255 total issues
Method file_set_field_by_map
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def file_set_field_by_map( file_name, fields, value_map, regex = nil )
lines = []
objects = []
- 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 call
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.call(record, value, operator)
logger.debug("Attempting Brute force assignment of value #{value} => [#{operator}]")
return if(attempt(record, value, operator))
- 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 map_inbound_headers
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def map_inbound_headers(klass, columns)
# If klass not in Dictionary yet, add to dictionary all possible operators on klass
# which can be used to map headers and populate an object of type klass
model_methods_collection = ModelMethods::Manager.catalog_class(klass)
Method call
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.call(load_object, value, method_binding)
# there are times when we need to save early, for example before assigning to
# has_and_belongs_to associations which require the load_object has an id for the join table
Method results_to_sheet
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def results_to_sheet( results, sheet, mappings = nil, header = true)
numrows = results.length
sheet_name = sheet
if numrows == 0
Method assign
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def assign(method_binding, record)
model_method = method_binding.model_method
operator = model_method.operator
Method populate
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.populate(klass, options = {} )
raise "Cannot find operators supplied klass nil #{klass}" if klass.nil?
register(klass)
- 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 determine_operator_class
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def determine_operator_class
if operator_for(:has_many) || operator_for(:belongs_to) || operator_for(:has_one)
result = klass.reflect_on_association(operator)
- 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 create_import_config
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_import_config(klass_or_name, options = {})
klass = MapperUtils.ensure_class(klass_or_name)
@key = 'data_flow_schema'
Method export_with_associations
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def export_with_associations(file_name, klass, export_records, options = {})
records = [*export_records]
state = DataShift::Configuration.call.with
Method prepare_data
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def prepare_data(method_binding, data)
raise NilDataSuppliedError, 'No method_binding supplied for prepare_data' unless method_binding
@original_data = data
Method to_xls
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_xls(items = [])
@excel = ExcelFile.new(items[0].class.name)
@excel.create_row(0)
Method build_assignments
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def build_assignments(klass, include_instance_methods)
begin
assignments[klass] = Catalogue.column_names(klass)
rescue StandardError => x
raise DataShiftException, "Failed to process column_names for class #{klass} - #{x.message}"
- 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 export
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def export(file_name, export_records, options = {})
@file_name = file_name
records = [*export_records]
- 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 file_set_field_by_map
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def file_set_field_by_map( file_name, fields, value_map, regex = nil )
lines = []
objects = []
Method perform_load
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform_load(options = {} )
raise 'The class that attachments belongs to has not been set (:attach_to_klass)' unless @attach_to_klass
raise "The field to search for attachment's owner has not been set (:attach_to_find_by_field)" unless @attach_to_find_by_field
Method get_record_by
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_record_by(klazz, field, search_term, split_on = ' ', options = {})
split_on_prefix = options[:add_prefix]
find_search_term = split_on_prefix ? "#{split_on_prefix}#{search_term}" : search_term
Method insistent_belongs_to
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def insistent_belongs_to(method_binding, record, value )
operator = method_binding.operator
klass = method_binding.model_method.operator_class
Method export_with_associations
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def export_with_associations(file_name, klass, export_records, options = {})
records = [*export_records]
state = DataShift::Configuration.call.with
- 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 to_hash_object
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def to_hash_object
h = {}
gsub(/[{}]/, '').split(',').each do |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"