File hosts_helper.rb
has 389 lines of code (exceeds 250 allowed). Consider refactoring. Open
module HostsHelper
include OperatingsystemsHelper
include HostsAndHostgroupsHelper
include ComputeResourcesVmsHelper
include HostsNicHelper
Method allocation_text_f
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def allocation_text_f(f)
active = 'Size'
active = 'None' if f.object.allocation.to_i == 0
active = 'Full' if f.object.allocation == f.object.capacity
text_f f, :allocation, :class => "input-mini", :label => _("Allocation (GB)"), :label_size => "col-md-2",
- 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_report_tooltip
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def last_report_tooltip(record)
opts = { :rel => "twipsy" }
date = record.last_report.nil? ? '' : date_time_absolute_value(record.last_report) + ", "
if @last_report_ids[record.id]
opts["data-original-title"] = date + _("view last report details")
- 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 inherited_by_default?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def inherited_by_default?(field, host)
return false unless host.hostgroup && host.hostgroup_id_was.nil?
return false if params[:action] == 'clone'
return true unless params[:host]
!params[:host][field]
- 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 multiple_actions_select
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def multiple_actions_select
select_action_button(_("Select Action"), {:id => 'submit_multiple'},
multiple_actions.map do |action|
# If the action array has 3 entries, the third one is whether to use a modal dialog or not
modal = (action.size == 3) ? action[3] : 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"