Showing 22 of 22 total issues
Method child
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def self.child(name, *args, option: nil, **opts, &block)
name.ensure_symbol!
child_class =
if args.first.is_a?(String) || args.first.is_a?(Class)
args.shift
- 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 define_callback
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.define_callback(time, name)
m_name = "#{time}_#{name}".to_sym
var = "@#{m_name}".to_sym
proc do
define_singleton_method(m_name) do |method = nil, &block|
- 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 sanitize
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.sanitize(**values)
Hash[values
.map do |k, v|
k = k.to_s
if k.include?('-')
- 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 section
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def section(*args)
@sections ||= []
args.flatten.each do |name|
name.is_a?(String) && name = name.to_sym
next unless name.is_a?(Symbol)
- 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 child
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.child(name, *args, option: nil, **opts, &block)
name.ensure_symbol!
child_class =
if args.first.is_a?(String) || args.first.is_a?(Class)
args.shift
Method unregister_block
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.unregister_block(options)
# Runs in helpers module class context
proc do |*list|
helpers = instance_methods
list.each do |helper|
- 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 place
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def place(src, at, dst = nil)
if dst == nil && at.is_a?(Hash) && at.keys.size == 1
dst = at.values[0]
at = at.keys[0]
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 switch
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def switch(name, options = {}, &block)
options.symbolize_keys!
name = name.to_sym
options.merge!(block: block, name: name)
if options.key?(:html_class)
Method do_compare
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def do_compare(target, *compare_args, &block)
return yield target if block_given?
options = compare_args.extract_options!
compare_args.map! { |x| x.is_a?(Proc) && x.lambda? ? x.call : x }
result = compare_args.any? do |dest|
- 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
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def render(*args, &render_block)
# return cached copy if it available
return @rendered unless @rendered.nil?
capture_sections
- 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 setter
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.setter(name, &block)
proc do |value|
opts = self.class.collect_derived(:@switches, {}, :merge)[name]
cb_return = block.nil? || instance_exec(value == true, &block)
unless cb_return == 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
Method setter
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.setter(name, &block)
->(value) do
opts = self.class.collect_derived(:@enums, {}, :merge)[name]
v = value if opts[:values].include?(value)
v ||= opts[:default] if opts.key?(:default)
- 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 extract_args
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def extract_args(args, list, instance = nil)
args.respond_to?(:extract!) || args.extend(WrapIt::CaptureArray)
list.each do |arg|
processed =
if arg[:first_only]
- 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 included
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.included(base)
base == Base || fail(
TypeError,
"#{self.class.name} can be included only into WrapIt::Base"
)
- 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
Consider simplifying this complex logical expression. Open
return unless placement.include?(src) &&
(dst == :begin || dst == :end || placement.include?(dst)) &&
(at == :before || at == :after)
Method prepare_child
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def prepare_child(helper_class, class_block, *args,
section: nil, **opts,
&helper_block)
Method add_children
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def add_children(name, item, extracted: false)
deffered_render? && @children << item
return if extracted == true
if !deffered_render? && (omit_content? || extract_children?)
self[item.render_to] << capture { item.render }
- 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 included
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.included(base)
base.class_eval do
extend ClassMethods
default_tag 'p', 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
Method enum
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def enum(name, values, opts = {}, &block)
opts.symbolize_keys!
name = name.ensure_symbol!
opts.merge!(block: block, name: name, values: values)
opts.key?(:default) && opts[:default] = opts[:default].to_sym
- 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 run_callbacks
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def run_callbacks(name)
self.class.collect_derived("@before_#{name}").each do |cb|
if cb.is_a?(Symbol)
send(cb) # if respond_to?(cb)
else
- 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"