Showing 61 of 614 total issues
Method read_cells
has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring. Open
def read_cells(sheet = default_sheet)
validate_sheet!(sheet)
return if @cells_read[sheet]
sheet_found = false
- 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
Class Base
has 52 methods (exceeds 20 allowed). Consider refactoring. Open
class Roo::Base
include Enumerable
include Roo::Formatters::Base
include Roo::Formatters::CSV
include Roo::Formatters::Matrix
File base.rb
has 460 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "tmpdir"
require "stringio"
require "nokogiri"
require "roo/utils"
require "roo/formatters/base"
File open_office.rb
has 453 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'date'
require 'nokogiri'
require 'cgi'
require 'zip/filesystem'
require 'roo/font'
Class Excelx
has 41 methods (exceeds 20 allowed). Consider refactoring. Open
class Excelx < Roo::Base
extend Roo::Tempdir
extend Forwardable
ERROR_VALUES = %w(#N/A #REF! #NAME? #DIV/0! #NULL! #VALUE! #NUM!).to_set
Class OpenOffice
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
class OpenOffice < Roo::Base
extend Roo::Tempdir
ERROR_MISSING_CONTENT_XML = 'file missing required content.xml'
XPATH_FIND_TABLE_STYLES = "//*[local-name()='automatic-styles']"
Method read_cells
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
def read_cells(sheet = default_sheet)
validate_sheet!(sheet)
return if @cells_read[sheet]
sheet_found = false
File excelx.rb
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'nokogiri'
require 'zip/filesystem'
require 'roo/link'
require 'roo/tempdir'
require 'roo/utils'
Method set_cell_values
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def set_cell_values(sheet, x, y, i, v, value_type, formula, table_cell, str_v, style_name)
key = [y, x + i]
@cell_type[sheet] ||= {}
@cell_type[sheet][key] = value_type.to_sym if value_type
@formula[sheet] ||= {}
- 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 cell_to_csv
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def cell_to_csv(row, col, sheet)
return "" if empty?(row, col, sheet)
onecell = cell(row, col, sheet)
- 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 initialize
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def initialize(filename_or_stream, options = {})
packed = options[:packed]
file_warning = options.fetch(:file_warning, :error)
cell_max = options.delete(:cell_max)
sheet_options = {}
- 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_xml
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def to_xml
Nokogiri::XML::Builder.new do |xml|
xml.spreadsheet do
sheets.each do |sheet|
self.default_sheet = sheet
- 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 ferien_fuer_region
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def ferien_fuer_region(proxy, region, year = nil)
proxy.first_row.upto(proxy.last_row) do |row|
if proxy.cell(row, 2) == region
jahr = proxy.cell(row, 1).to_i
if year.nil? || jahr == year
- 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 expand_merged_ranges
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def expand_merged_ranges(cells)
# Extract merged ranges from xml
merges = {}
doc.xpath('/worksheet/mergeCells/mergeCell').each do |mergecell_xml|
src, dst = mergecell_xml["ref"].split(/:/).map { |ref| ::Roo::Utils.ref_to_key(ref) }
- 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 perform_decryption
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform_decryption(
encryption_data,
password,
content_entry,
roo_content_xml_path
Method row_with
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def row_with(query, return_headers = false)
line_no = 0
closest_mismatched_headers = []
each do |row|
line_no += 1
- 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 cell_to_csv
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cell_to_csv(row, col, sheet)
return "" if empty?(row, col, sheet)
onecell = cell(row, col, sheet)
Method instance_cache
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def instance_cache(key)
object = nil
if instance_variable_defined?(key) && (ref = instance_variable_get(key)) && ref.weakref_alive?
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
Method to_yaml
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def to_yaml(prefix = {}, from_row = nil, from_column = nil, to_row = nil, to_column = nil, sheet = default_sheet)
# return an empty string if there is no first_row, i.e. the sheet is empty
return "" unless first_row
from_row ||= first_row(sheet)
- 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 set_cell_values
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_cell_values(sheet, x, y, i, v, value_type, formula, table_cell, str_v, style_name)
key = [y, x + i]
@cell_type[sheet] ||= {}
@cell_type[sheet][key] = value_type.to_sym if value_type
@formula[sheet] ||= {}