Showing 54 of 54 total issues
Method columns_to_cells
has a Cognitive Complexity of 101 (exceeds 5 allowed). Consider refactoring. Open
def columns_to_cells(nature, options = {})
code = ''
unless %i[body children].include?(nature)
raise ArgumentError, 'Nature is invalid'
end
- 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
File simple_renderer.rb
has 387 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ActiveList
module Renderers
class SimpleRenderer < AbstractRenderer
include ActiveList::Helpers
Method operation
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def operation(record = 'record_of_the_death')
link_options = ''
if @options[:confirm]
link_options << ", 'data-confirm' => #{(@options[:confirm]).inspect}.t(scope: 'labels')"
end
- 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 columns_to_cells
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
def columns_to_cells(nature, options = {})
code = ''
unless %i[body children].include?(nature)
raise ArgumentError, 'Nature is invalid'
end
Method column_classes
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def column_classes(column, without_id = false, without_interpolation = false)
classes = []
conds = []
conds << [:sor, "#{var_name(:params)}[:sort] == '#{column.sort_id}'".c] if column.sortable?
conds << [:hidden, "#{var_name(:params)}[:hidden_columns].include?(:#{column.name})".c] if column.is_a? ActiveList::Definition::DataColumn
- 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_table_code
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_table_code(options = {})
record = 'r'
# colgroup = columns_definition_code
header = header_code
Method select_data_code
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def select_data_code(options = {})
paginate = (options.key?(:paginate) ? options[:paginate] : @table.paginate?)
# Check order
unless @table.options.keys.include?(:order)
columns = @table.table_columns
- 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 21 (exceeds 5 allowed). Consider refactoring. Open
def initialize(table, name, options = {})
super(table, name, options)
unless @options[:through]
raise ArgumentError, 'Option :through must be given'
end
- 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 extras_codes
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def extras_codes
code = []
codes = {}
if table.global_action_columns.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 build_table_code
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def build_table_code(options = {})
record = 'r'
# colgroup = columns_definition_code
header = header_code
- 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 Table
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Table
attr_reader :name, :model, :options, :id, :columns, :parameters
def initialize(name, model = nil, options = {})
@name = name
Method header_code
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def header_code
code = ''
code << "'<thead><tr>"
if table.selectable?
code << '<th class="list-selector"><input type="checkbox" data-list-selector="all" /></th>'
- 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 operation
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def operation(record = 'record_of_the_death')
link_options = ''
if @options[:confirm]
link_options << ", 'data-confirm' => #{(@options[:confirm]).inspect}.t(scope: 'labels')"
end
Method select_data_code
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def select_data_code(options = {})
paginate = (options.key?(:paginate) ? options[:paginate] : @table.paginate?)
# Check order
unless @table.options.keys.include?(:order)
columns = @table.table_columns
Method column_classes
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def column_classes(column, without_id = false, without_interpolation = false)
classes = []
conds = []
conds << [:sor, "#{var_name(:params)}[:sort] == '#{column.sort_id}'".c] if column.sortable?
conds << [:hidden, "#{var_name(:params)}[:hidden_columns].include?(:#{column.name})".c] if column.is_a? ActiveList::Definition::DataColumn
Method select_code
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def select_code
return nil unless @table.options[:distinct] || @table.options[:select]
code = ''
code << 'DISTINCT ' if @table.options[:distinct]
if @table.options[:select]
- 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 extras_codes
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def extras_codes
code = []
codes = {}
if table.global_action_columns.any?
Method send_data_code
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def send_data_code
xml_escape = "to_s.gsub('&', '&').gsub('\\'', ''').gsub('<', '<').gsub('>', '>')"
xml_escape << ".force_encoding('US-ASCII')" if xml_escape.respond_to?(:force_encoding)
record = 'r'
code = generator.select_data_code(paginate: false)
Method initialize
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(table, name, options = {})
super(table, name, options)
unless @options[:through]
raise ArgumentError, 'Option :through must be given'
end
Method columns_to_array
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def columns_to_array(nature, options = {})
columns = table.exportable_columns
array = []
record = options[:record] || 'record_of_the_death'
- 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"