Method menu_button
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def menu_button(label, path, options={})
return '' unless path.present?
defaults = {
enabled: true,
- 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 delete_menu_button
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def delete_menu_button(content_item=nil, opts={class: []})
classes = ["btn", "http_delete", "confirm_with_title"]
if current_user.able_to_publish?(content_item)
classes << 'btn-primary'
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"
Further reading
Method button_menu
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def button_menu(location)
container_class = location == :top ? 'span6 top-buttons' : 'form-actions clearfix'
container_element = location == :top ? 'span' : 'div'
content_tag container_element, class: container_class do
yield if block_given?
- 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"