Showing 12 of 12 total issues
Class Table
has 41 methods (exceeds 20 allowed). Consider refactoring. Open
class Table
attr_reader :collection, :grouped_data, :subtotals, :totals,
:subtotal_calculations, :total_calculations, :columns
attr_accessor :id, :title, :css_class, :empty_text,
File table.rb
has 358 lines of code (exceeds 250 allowed). Consider refactoring. Open
module DataTable
##
# Config Options
#
# id: the html id
Method render_group_recursive
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def render_group_recursive(collection, index = 1, group_parent = nil, ancestors = nil)
html = ''
ancestors ||= []
collection.each_pair do |group_name, group_data|
ancestors << group_parent unless ancestors[0] == group_parent
- 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 render_subtotals
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def render_subtotals(group_header, _group_data = nil, ancestors = nil)
html = ''
path = ancestors.nil? ? [] : ancestors.dup
path << group_header
- 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 render_rows
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def render_rows(collection)
html = ''
collection.each_with_index do |row, row_index|
css_class = @alternate_rows && row_index.odd? ? 'alt ' : ''
if @row_style && style = @row_style.call(row, 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 calculate_totals!
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def calculate_totals!
@total_calculations = []
@totals.each_with_index do |row, index|
next if row.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 total_row
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def total_row(collection, column_name, function = nil, index = nil, &block)
Method render_parent_subtotals
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def render_parent_subtotals(group_array)
html = ''
@parent_subtotals[group_array].each_with_index do |group, index|
next if group.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 render_data_table
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def render_data_table
html = "<table id='#{@id}' class='data_table #{@css_class}' cellspacing='0' cellpadding='0'>"
html << "<caption>#{@title}</caption>" if @title
html << render_data_table_header if @display_header
if @collection.any?
- 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 calculate_parent_subtotals
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def calculate_parent_subtotals
@parent_subtotals = Hash.new { |h, k| h[k] = [] }
# Iterate over all the parent groups
parent_groups = @groupings.slice(0, @groupings.count - 1).compact
parent_groups.count.times do
- 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 total_row
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def total_row(collection, column_name, function = nil, index = nil, &block)
function_or_block = function || block
f = function && block_given? ? [function, block] : function_or_block
(0..index).each do |index|
collection[index] = {} if collection[index].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 render_cell
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def render_cell(cell_data, row = nil, row_index = 0, col_index = 0)
@data_type ||= type(cell_data)
html = []
html << if @renderer && 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"