app/helpers/resolve_helper.rb
Method list_with_limit
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
def list_with_limit(id, list, options = {}, &block)
# backwards compatible to when third argument was just a number
# for limit.
options = {:limit => options} unless options.kind_of?(Hash)
options[:limit] ||= 5
- 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 list_with_limit
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def list_with_limit(id, list, options = {}, &block)
# backwards compatible to when third argument was just a number
# for limit.
options = {:limit => options} unless options.kind_of?(Hash)
options[:limit] ||= 5
Method expand_contract_section
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def expand_contract_section(arg_heading, id, options={}, &block)
expanded = (params["umlaut.show_#{id}"] == "true") || options[:initial_expand] || false
icon = content_tag(:i, nil, :class => [] << ( expanded ? "umlaut_icons-list-open" : "umlaut_icons-list-closed"))
heading = content_tag(:span,( expanded ? "Hide " : "Show "), :class=>'expand_contract_action_label') + arg_heading
body_class = (expanded ? "in" : "")
- 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"