ManageIQ/manageiq

View on GitHub

Showing 1,304 of 1,304 total issues

Method scan_from_queue has a Cognitive Complexity of 95 (exceeds 11 allowed). Consider refactoring.
Open

def scan_from_queue(taskid = nil)
unless taskid.nil?
task = MiqTask.find_by(:id => taskid)
task.state_active if task
end
Severity: Minor
Found in app/models/host.rb - About 1 day to fix

Method search has a Cognitive Complexity of 81 (exceeds 11 allowed). Consider refactoring.
Open

def search(options = {})
if options.key?(:targets) && options[:targets].kind_of?(Array) && options[:targets].empty?
return [], {:auth_count => 0}
end
 
 
Severity: Minor
Found in lib/rbac/filterer.rb - About 1 day to fix

Method performances_maintains_value_for_duration? has a Cognitive Complexity of 72 (exceeds 11 allowed). Consider refactoring.
Open

def performances_maintains_value_for_duration?(options)
_log.info("options: #{options.inspect}")
raise _("Argument must be an options hash") unless options.kind_of?(Hash)
 
column = options[:column]
Severity: Minor
Found in app/models/metric/ci_mixin.rb - About 1 day to fix

Method action_snmp_trap has a Cognitive Complexity of 71 (exceeds 11 allowed). Consider refactoring.
Open

def action_snmp_trap(action, rec, inputs)
# Validate SNMP Version
snmp_version = action.options[:snmp_version]
snmp_version = 2 if action.options[:snmp_version] == "v2"
snmp_version = 1 if action.options[:snmp_version] == "v1"
Severity: Minor
Found in app/models/miq_action.rb - About 1 day to fix

Method process_derived_columns has a Cognitive Complexity of 68 (exceeds 11 allowed). Consider refactoring.
Open

def self.process_derived_columns(obj, attrs, ts = nil)
unless VALID_PROCESS_TARGETS.any? { |t| obj.kind_of?(t) }
raise _("object %{name} is not one of %{items}") % {:name => obj,
:items => VALID_PROCESS_TARGETS.collect(&:name).join(", ")}
end
Severity: Minor
Found in app/models/metric/processing.rb - About 1 day to fix

Method save_vms_inventory has a Cognitive Complexity of 67 (exceeds 11 allowed). Consider refactoring.
Open

def save_vms_inventory(ems, hashes, target = nil)
return if hashes.nil?
 
target = ems if target.nil?
log_header = "EMS: [#{ems.name}], id: [#{ems.id}]"
Severity: Minor
Found in app/models/ems_refresh/save_inventory.rb - About 1 day to fix

Method tl_event has a Cognitive Complexity of 66 (exceeds 11 allowed). Consider refactoring.
Open

def tl_event(row, col)
mri = options.mri
tz = mri.get_time_zone(Time.zone.name)
etime = row[col]
return if etime.nil? # Skip nil dates - Sprint 41
Severity: Minor
Found in lib/manageiq/reporting/formatter/timeline.rb - About 1 day to fix

Method validate has a Cognitive Complexity of 60 (exceeds 11 allowed). Consider refactoring.
Open

def validate(values)
# => Input - A hash keyed by field name with entered values
# => Output - true || false
#
# Update @dialogs adding error keys to fields that don't validate
Severity: Minor
Found in app/models/miq_request_workflow.rb - About 1 day to fix

Method atom_error has a Cognitive Complexity of 58 (exceeds 11 allowed). Consider refactoring.
Open

def self.atom_error(field, operator, value)
return false if operator == "DEFAULT" # No validation needed for style DEFAULT operator
 
value = value.to_s unless value.kind_of?(Array)
 
 
Severity: Minor
Found in lib/miq_expression.rb - About 1 day to fix

Method process_data has a Cognitive Complexity of 57 (exceeds 11 allowed). Consider refactoring.
Open

def process_data(*args)
_log.info("starting...")
 
data = args.first
set_status("Processing VM data")
Severity: Minor
Found in app/models/vm_scan.rb - About 7 hrs to fix

Method fetch_record_section has a Cognitive Complexity of 56 (exceeds 11 allowed). Consider refactoring.
Open

def fetch_record_section(id, section, sub_sections, columns)
section = section[:name]
result_section = @results[id][section] = {}
rec = find_record(id)
 
 
Severity: Minor
Found in app/models/miq_compare.rb - About 7 hrs to fix

Method build_html_rows has a Cognitive Complexity of 52 (exceeds 11 allowed). Consider refactoring.
Open

def build_html_rows(clickable_rows = false)
time_zone = get_time_zone(Time.zone)
html_rows = []
group_counter = 0
row = 0
Severity: Minor
Found in app/models/miq_report/generator/html.rb - About 7 hrs to fix

Method xml_to_hashes has a Cognitive Complexity of 50 (exceeds 11 allowed). Consider refactoring.
Open

def self.xml_to_hashes(xmlNode, vm_or_template_id)
return nil unless MiqXml.isXmlElement?(xmlNode)
 
all_nh = []
 
 
Severity: Minor
Found in app/models/snapshot.rb - About 6 hrs to fix

Cyclomatic complexity for performances_maintains_value_for_duration? is too high. [52/11]
Open

def performances_maintains_value_for_duration?(options)
_log.info("options: #{options.inspect}")
raise _("Argument must be an options hash") unless options.kind_of?(Hash)
 
column = options[:column]
Severity: Minor
Found in app/models/metric/ci_mixin.rb by rubocop

Method build_add_includes has a Cognitive Complexity of 48 (exceeds 11 allowed). Consider refactoring.
Open

def build_add_includes(data_records, entry, includes, parent_association)
include_has_options = includes.kind_of?(Hash)
associations = include_has_options ? includes.keys : Array(includes)
 
associations.each do |association|
Severity: Minor
Found in app/models/miq_report/generator.rb - About 6 hrs to fix

Method build_document_body has a Cognitive Complexity of 48 (exceeds 11 allowed). Consider refactoring.
Open

def build_document_body
mri = options.mri
tz = mri.get_time_zone(Time.zone.name)
s = @hr
 
 
Severity: Minor
Found in lib/manageiq/reporting/formatter/text.rb - About 6 hrs to fix

Cyclomatic complexity for search is too high. [51/11]
Open

def search(options = {})
if options.key?(:targets) && options[:targets].kind_of?(Array) && options[:targets].empty?
return [], {:auth_count => 0}
end
 
 
Severity: Minor
Found in lib/rbac/filterer.rb by rubocop

Cyclomatic complexity for save_vms_inventory is too high. [50/11]
Open

def save_vms_inventory(ems, hashes, target = nil)
return if hashes.nil?
 
target = ems if target.nil?
log_header = "EMS: [#{ems.name}], id: [#{ems.id}]"

Method process_hourly_for_one_day has a Cognitive Complexity of 46 (exceeds 11 allowed). Consider refactoring.
Open

def self.process_hourly_for_one_day(recs, options = {})
only_cols = process_only_cols(recs)
result = {}
counts = {}
 
 
Severity: Minor
Found in app/models/vim_performance_daily.rb - About 6 hrs to fix

Method add_elements has a Cognitive Complexity of 45 (exceeds 11 allowed). Consider refactoring.
Open

def self.add_elements(parent, xmlNode)
hashes = xml_to_hashes(parent, xmlNode)
return if hashes.nil?
 
deletes = {}
Severity: Minor
Found in app/models/volume.rb - About 5 hrs to fix
Severity
Category
Status
Source
Language