Method key
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def key
if @object.try(:id).nil?
# FIXME: this makes problems in tests
# to handle "Unassigned groups" node in automate buttons tree
"-#{@object.name.split('|').last}"
- Read upRead up
- Create a ticketCreate a ticket
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 set_attributes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_attributes(*attributes, &block)
attributes.each do |attribute|
define_method(attribute) do
result = instance_variable_get("@#{attribute}".to_sym)
- Read upRead up
- Create a ticketCreate a ticket
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_h
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_h
{
:key => key,
:text => escape(text),
:tooltip => escape(tooltip),
- Read upRead up
- Create a ticketCreate a ticket
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 set_attribute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_attribute(attribute, value = nil, &block)
atvar = "@#{attribute}".to_sym
define_method(attribute) do
result = instance_variable_get(atvar)
- Read upRead up
- Create a ticketCreate a ticket
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
Check block argument explicitly instead of using block_given?
. Open
if block_given?
- Create a ticketCreate a ticket
- Exclude checks