Showing 47 of 61 total issues
Method stream
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def stream
stream = Zip::OutputStream.write_buffer { |zipstream|
self.rels_hash = {}
self.relationship_container.owner = self
collect_related_objects.compact.each { |obj|
- 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 insert_row
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def insert_row(row_index = 0)
validate_workbook
ensure_cell_exists(row_index)
old_row = new_cells = nil
Method initialize
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def initialize(*params)
row_from = row_to = col_from = col_to = nil
case params.size
when 4 then row_from, row_to, col_from, col_to = params
- 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 add_cell
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_cell(row_index = 0, column_index = 0, data = '', formula = nil, overwrite = true)
validate_workbook
validate_nonnegative(row_index)
validate_nonnegative(column_index)
row = sheet_data.rows[row_index] || add_row(row_index)
Method before_write_xml
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def before_write_xml # This method may need to be moved higher in the hierarchy
first_nonempty_row = nil
last_nonempty_row = 0
first_nonempty_column = nil
last_nonempty_column = 0
Method initialize
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(worksheets = [], src_file_path = nil, creator = nil, modifier = nil, created_at = nil,
company = '', application = APPLICATION, appversion = APPVERSION, date1904 = 0,
is_template = false)
Method value
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def value(args = {})
r = self.raw_value
case datatype
when RubyXL::DataType::SHARED_STRING then workbook.shared_strings_container[r.to_i].to_s
- 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 before_write_xml
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def before_write_xml
content_types_by_ext = {}
# Collect all extensions and corresponding content types
root.rels_hash.each_pair { |klass, objects|
Method insert_column
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def insert_column(column_index = 0)
validate_workbook
ensure_cell_exists(0, column_index)
old_range = cols.get_range(column_index)
Method collect_related_objects
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def collect_related_objects
res = related_objects.compact # Avoid tainting +related_objects+ array
res.concat(generic_storage) if generic_storage
if relationship_container then
- 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 attach_relationship
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def attach_relationship(rid, rf)
relationships = self.class.class_variable_get(:@@ooxml_relationships)
klass = rf.class
if relationships.has_key?(klass) then
accessor = relationships[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 validate_workbook
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate_workbook
unless workbook.nil? || workbook.worksheets.nil?
workbook.worksheets.each { |sheet|
unless sheet.nil? || sheet.sheet_data.nil? || sheet.sheet_data[row].nil?
if sheet.sheet_data[row][column] == self
- 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_hls
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def to_hls
hls_color = HlsColor.new
# Note that we are overriding accessors with local vars here:
r = self.r / 255.0
- 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 insert_cell
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def insert_cell(row = 0, col = 0, data = nil, formula = nil, shift = nil)
Method change_column_font
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def change_column_font(column_index, change_type, arg, font, xf)
Method add_cell
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_cell(row_index = 0, column_index = 0, data = '', formula = nil, overwrite = true)
Method parse
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.parse(param)
sheet_obj = super
sheet_obj.sheet_data.rows.each { |r|
next if r.nil?
r.worksheet = sheet_obj
- 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 change_column_alignment
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def change_column_alignment(column_index, &block)
validate_workbook
ensure_cell_exists(0, column_index)
cols.get_range(column_index).style_index = @workbook.modify_alignment(get_col_style(column_index), &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 change_column_fill
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def change_column_fill(column_index, color_code = 'ffffff')
validate_workbook
RubyXL::Color.validate_color(color_code)
ensure_cell_exists(0, column_index)
- 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 get_range
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_range(col_index)
col_num = col_index + 1
old_range = self.locate_range(col_index)
- 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"