Showing 12 of 37 total issues
Method get_brothers
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_brothers(person)
ret = []
tmp_family = family.dup
person.parent_ids.each do |parent_id|
tmp_family.each do |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 setting_variables_code
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def setting_variables_code(variables)
fail TypeError, "invalid type #{variables.class}. you have to use Array" unless variables.is_a? Array
variables.reduce([]) do |ret, variable|
fail TypeError, "invalid type #{variable.class}. you have to use Hash" unless variable.is_a? Hash
fail TypeError, 'invalid hash. you have to set Hash[:name]' if variable[:name].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 to_heading
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def to_heading
self_chars = chars
level, index, word_ret, ret = 0, 0, [], []
self_chars.each_with_index do |v, index|
key_word = v.in? %w(> + ^)
- 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 must_impl
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def must_impl(*methods)
return if methods.nil?
fail TypeError, "invalid args type #{methods.class}. you must use Array or Symbol" unless methods.class.any_of? Array, Symbol
methods = (methods.class.is_a? Symbol) ? [methods] : methods
methods.each do |method_name|
- 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 together_fill
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def together_fill(fill_value = nil, &block)
if_not_contain_array_rails_type_error
if block
fill_value = 0 if fill_value.nil?
first.each_with_index do |i_v, i|
- 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 start_match
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def start_match(proc)
@tournament.reverse_each.with_index do |outer, outer_index|
outer.reverse_each.with_index do |inner, inner_index|
next if inner_index.odd?
next if inner_index == outer.size - 1
- 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 to_html_table
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def to_html_table(options = { no_header: false })
options[:no_header] = false if options[:no_header].nil?
cnt = options[:no_header] ? 1 : 0
ret = reduce(['<table>']) do |rets, lines|
ret = lines.reduce([]) do |ret, column|
- 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 first_attr
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def first_attr(attribute, method_name, *args, &block)
col = collection
return [] if col.empty?
first_size = args.size == 0 ? nil : Integer(args.first)
fail ArgumentError, "invalid attribute #{attribute}" unless include_attr?(col.first, attribute)
- 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 last_attr
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def last_attr(attribute, method_name, *args, &block)
col = collection
return [] if col.empty?
last_size = args.size == 0 ? nil : Integer(args.last)
fail ArgumentError, "invalid attribute #{attribute}" unless include_attr?(col.last, attribute)
- 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 slice_attr
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def slice_attr(attribute, method_name, *args, &block)
check_argument_length(*args)
col = collection
index_or_range = args.first
length = args.size > 1 ? args[1] : 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 exchange!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def exchange!(one_index, other_index)
return self unless one_index.respond_to? :to_i
return self unless other_index.respond_to? :to_i
one_index = one_index.to_i
other_index = other_index.to_i
- 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 link
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.link(label, url)
label = '' if label.nil?
url = '' if url.nil?
return label unless label.is_a?(String)
return url unless url.is_a?(String)
- 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"