Method labelled_check_box
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def labelled_check_box(method, text = nil, check_box_options = {})
label_options = check_box_options.delete(:label) || {}
if check_box_options[:editable] == false
labelled_text method, @object.send(method) ? "Yes" : "No", text, check_box_options
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 labelled_text_field
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def labelled_text_field(method, text = method.to_s.titleize, text_field_options = { class: "form-control" })
label_options = text_field_options.delete(:label) || { class: "control-label col-sm-4" }
editable = text_field_options.delete(:editable)
if editable == false
%(#{label(method, (text || method.to_s.titleize).to_s, label_options)} <div id="#{object_name}_#{method}">#{@object.send(method)}</div>).html_safe
- 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 labelled_select
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def labelled_select(method, choices, options = {}, html_options = { class: "form-control" })
label_options = options.delete(:label) || { class: "control-label col-sm-4" }
text = label_options.delete(:text) if label_options
if options[:editable] == false
%(#{label(method, (text || method.to_s.titleize).to_s, label_options)} <div id="#{object_name}_#{method}">#{@object.send(method)}</div>).html_safe
- 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"