Showing 255 of 255 total issues
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
Block has too many lines. [30/25] Open
load_object_class.transaction do
logger.info "Processing #{parsed_file.size} rows"
parsed_file.each_with_index do |row, i|
- 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. [29/25] Open
task :purge, [:exclude_system_tables] => [:environment] do |_t, args|
require 'highline/import'
agree('WARNING: In Production database, REALLY PURGE ? [y]:') if Rails.env.production?
- 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. [29/25] Open
columns.each do |col_str|
# split into usable parts ; size:large or colour:red,green,blue
field, find_by_values = Querying.where_field_and_values(method_binding, col_str )
raise "Cannot perform DB find by #{field}. Expected format key:value" unless field && find_by_values
- 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. [29/25] Open
sheet.each_with_index do |row, current_row_idx|
next if current_row_idx == headers.idx
# Excel num_rows seems to return all 'visible' rows, which appears to be greater than the actual data rows
- 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 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 = {})
Block has too many lines. [28/25] Open
ActiveRecord::Base.connection.tables.each do |table|
modules.each do |m|
@klass = DataShift::MapperUtils.table_to_arclass(table, m)
break if(@klass)
- 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. [28/25] Open
ActiveRecord::Base.connection.tables.each do |table|
modules.each do |m|
@klass = DataShift::MapperUtils.table_to_arclass(table, m)
break if(@klass)
- 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 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"