Showing 67 of 255 total issues
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
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"
Further reading
Method create_worksheet
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_worksheet( options = {} )
sheet_name = options[:name]
@workbook = HSSFWorkbook.new if @workbook.nil?
- 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_paperclip_attachment
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_paperclip_attachment(klass, attachment_path, options = {})
has_attached_file_attribute = options[:has_attached_file_name] ? options[:has_attached_file_name].to_sym : :attachment
attachment_file = get_file(attachment_path)
- 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_attachment
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_attachment(klass, attachment_path, record = nil, attach_to_record_field = nil, options = {})
Method file_set_field
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def file_set_field( file_name, field, old_value, new_value, regex = nil )
Method get_record_by!
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_record_by!(klazz, field, search_terms, split_on = ' ', options = {} )
Method get_record_by
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_record_by(klazz, field, search_term, split_on = ' ', options = {})
Method add_comment
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def add_comment( cell, text )
raise 'Please supply valid HSSFCell' unless cell.respond_to?('setCellComment')
return if @sheet.nil?
patriarch = @patriarchs[@sheet.getSheetName]
- 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 autosize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def autosize(column = nil)
return if @sheet.nil?
if column.is_a? Integer
@sheet.autoSizeColumn(column)
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 bind_headers
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def bind_headers( headers )
logger.info("Binding #{headers.size} inbound headers to #{load_object_class.name}")
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
Avoid too many return
statements within this method. Open
when HSSFCell::CELL_TYPE_BLANK then return ''
Avoid too many return
statements within this method. Open
when HSSFCell::CELL_TYPE_BOOLEAN then return cell.getBooleanCellValue
Avoid too many return
statements within this method. Open
when HSSFCell::CELL_TYPE_ERROR then return cell.getErrorCellValue
Method export_with_associations
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def export_with_associations(file_name, klass, records, options = {})
state = DataShift::Configuration.call.with
DataShift::Configuration.call.with = :all
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def export(file, export_records, options = {})
records = [*export_records]
if records.blank?
logger.warn('Excel Export - No objects supplied for export - no file written')
- 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"