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 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 initialize
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def initialize(table, name, options = {})
super(table, name, options)
@use_mode = (@options.delete(:on) || :single).to_sym
unless USE_MODES.include?(@use_mode)
raise "Invalid use mode: #{@use_mode.inspect}"
- 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 default_url
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def default_url(use_mode = :many)
url = @options[:url] ||= {}
url[:controller] ||= (@options[:controller] || table.model.name.tableize)
url[:action] ||= @name.to_s
url[:format] = @options[:format] if @options.key? :format
- 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"