Showing 39 of 1,335 total issues
Method parse_csv
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse_csv csv_raw, options = {}
optimistic_date_converter = Workbook::Cell.new.string_optimistic_date_converter
options = {
converters: [optimistic_date_converter, :all]
}.merge(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 trim!
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def trim!(desired_length = nil)
self_count = count - 1
count.times do |index|
index = self_count - index
if desired_length && (index < desired_length)
- 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 format_to_xlsx_format
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def format_to_xlsx_format f
f = make_sure_f_is_a_workbook_format f
xlsfmt = {}
xlsfmt[:fg_color] = "FF#{f[:color].to_s.upcase}".delete("#") if f[:color]
- 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 []=
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def []= index_or_hash, value
index = index_or_hash
if index_or_hash.is_a? Symbol
index = table_header_keys.index(index_or_hash)
elsif index_or_hash.is_a?(String) && index_or_hash.match(/^[A-Z]*$/)
- 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 build_cell_options
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def build_cell_options cell, options = {}
classnames = cell.format.all_names
classnames += options[:classnames] if options[:classnames]
classnames = classnames.join(" ").strip
td_options = classnames != "" ? {class: classnames} : {}
- 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 has_background_color?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def has_background_color? color = :any
bg_color = flattened[:background_color] ? flattened[:background_color].to_s.downcase : nil
if (color != :any) && bg_color
bg_color == color.to_s.downcase
- 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 []
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def [] index_or_string
if index_or_string.is_a? String
match = index_or_string.match(/([A-Z]+)([0-9]*)/i)
col_index = Workbook::Column.alpha_index_to_number_index(match[1])
if match[2] == ""
- 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_xlsx_styles
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse_xlsx_styles(styles)
styles = Nokogiri::XML(styles)
fonts = parse_xlsx_fonts(styles)
backgrounds = extract_xlsx_backgrounds(styles)
- 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 align
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def align other, options = {}
options = {sort: true, ignore_headers: false}.merge(options)
sother = other.clone.remove_empty_lines!
sself = clone.remove_empty_lines!
- 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 load_ods
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def load_ods file_obj, options = {}
file_obj = file_obj.path if file_obj.is_a? File
content = ""
styles = ""
- 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 []
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def [](index_or_hash)
if index_or_hash.is_a? Symbol
rv = nil
begin
rv = to_hash[index_or_hash]
- 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 text_to_utf8
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def text_to_utf8 text
unless text.valid_encoding? && (text.encoding == "UTF-8")
# TODO: had some ruby 1.9 problems with rchardet ... but ideally it or a similar functionality will be reintroduced
source_encoding = text.valid_encoding? ? text.encoding : "US-ASCII"
text = text.encode("UTF-8", source_encoding, invalid: :replace, undef: :replace, replace: "")
- 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 align_row
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def align_row sself, sother, row_index
asd = 0
if sself.rows[row_index] && sother.rows[row_index]
asd = sself.rows[row_index].key <=> sother.rows[row_index].key
elsif sself.rows[row_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 <=>
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def <=> other
a = header? ? 0 : 1
b = other.header? ? 0 : 1
return (a <=> b) if (a == 0) || (b == 0)
@cells <=> other.cells
- 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_local_value
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse_local_value(valuetype)
value = CGI.unescapeHTML(@cell.xpath("text:p//text()").to_s)
value = value == "" ? nil : value
case valuetype
when "integer"
- 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 string_non_american_date_converter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def string_non_american_date_converter
proc do |v|
rv = v
# try strptime with format 'mm/dd/yyyy'
if rv.is_a?(String) && /^\d{1,2}[\/\-.]\d{1,2}[\/\-.]\d{4}$/ =~ v
- 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_or_find_format_by
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_or_find_format_by name, variant = :default
fs = @formats[name]
fs = @formats[name] = {} if fs.nil?
f = fs[variant]
if f.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 initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize row_cel_values = [], sheet = nil, options = {}
@rows = []
row_cel_values = [] if row_cel_values.nil?
row_cel_values.each_with_index do |r, ri|
if r.is_a? Workbook::Row
- 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 prepare_cell
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def prepare_cell cell, options
if cell.is_a? Workbook::Cell
cell = cell.clone if options[:clone_cells]
else
cell = Workbook::Cell.new(cell, {row: 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"