Showing 255 of 255 total issues
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 = []
Block has too many lines. [35/25] Open
namespace :datashift do
namespace :db do
SYSTEM_TABLE_EXCLUSION_LIST = ['schema_migrations'].freeze
- Read upRead up
- Exclude checks
This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.
Block has too many lines. [35/25] Open
load_object_class.transaction do
sheet.each_with_index do |row, current_row_idx|
next if current_row_idx == headers.idx
- Read upRead up
- Exclude checks
This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.
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
Block has too many lines. [33/25] Open
namespace :db do
SYSTEM_TABLE_EXCLUSION_LIST = ['schema_migrations'].freeze
desc 'Purge the current database'
- Read upRead up
- Exclude checks
This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.
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"
Further reading
Method activate_sheet
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def activate_sheet(term)
if @workbook
x = term.is_a?(String) ? @workbook.getSheetIndex(term.to_java(java.lang.String)) : term
@sheet = worksheet(x)
- 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 process_missing_records
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def process_missing_records( missing_records )
unless missing_records.empty?
FileUtils.mkdir_p('MissingAttachmentRecords') unless File.directory?('MissingAttachmentRecords')
puts "WARNING : #{missing_records.size} of #{loading_files_cache.size} files could not be attached to a #{load_object_class}"
- 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 active_worksheet
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def active_worksheet(term = nil)
if @workbook
if term.nil?
@sheet ||= @workbook.getSheetAt(@current_sheet_index)
else
- 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 record_to_column
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def record_to_column(record, json = false)
return '' if record.nil? || (record.respond_to?(:each) && record.empty?)
# :only and :except options can be used to limit the attributes included
- 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 parse_headers
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse_headers( sheet, header_row_idx = 0 )
headers = DataShift::Headers.new(:excel, header_row_idx)
header_row = sheet.row(header_row_idx)
- 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
Block has too many lines. [32/25] Open
String.class_eval do
# Convert DSL string forms into a hash
# e.g
#
# "{:name => 'autechre'}" => Hash['name'] = autechre'
- Read upRead up
- Exclude checks
This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.
Method method_missing
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def method_missing(method, *args, &block)
# puts @excel.class, method, args.inspect
if @excel.respond_to?(method)
@excel.send(method, *args, &block)
- 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"