ManageIQ/manageiq-gems-pending

View on GitHub

Showing 88 of 217 total issues

Method miq_patch_elements has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def miq_patch_elements(xml, patch, node, direction, stats)
miq_patch_element_logging(node, direction)
patch.root.elements[node.to_s].each_element do |e|
path = e.elements['path'].elements[1]
data = e.elements['data'].elements[1]
Severity: Minor
Found in lib/gems/pending/util/xml/xml_patch.rb - About 1 hr to fix

Method findRegElementInt has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def self.findRegElementInt(paths, ele)
if paths.length > 0
searchStr = paths[0].downcase
paths = paths[1..paths.length]
# puts "Search String: #{searchStr}"
Severity: Minor
Found in lib/gems/pending/util/xml/xml_hash.rb - About 1 hr to fix

Method findRegElementInt has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def self.findRegElementInt(paths, ele)
if paths.length > 0
searchStr = paths[0].downcase
paths = paths[1..paths.length]
# puts "Search String: #{searchStr}"
Severity: Minor
Found in lib/gems/pending/util/xml/miq_rexml.rb - About 1 hr to fix

Method miq_find_diff_element2 has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def miq_find_diff_element2(searchNode, xml)
# Loop over each element to find matching elements at the current level
xml.each_element do |dataNode|
comp_rc = miq_same_element(searchNode, dataNode)
if comp_rc.zero?
Severity: Minor
Found in lib/gems/pending/util/xml/xml_patch.rb - About 1 hr to fix

Method processInfo has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def self.processInfo(pid = nil)
pid ||= Process.pid
 
result = {:pid => pid}
 
 
Severity: Minor
Found in lib/gems/pending/util/miq-process.rb - About 1 hr to fix

Method _key_type= has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def _key_type=(value)
raise ArgumentError, "key type must be Symbol or String" unless [Symbol, String].include?(value)
 
unless @key_type == value
m = (value == String) ? :to_s : :to_sym
Severity: Minor
Found in lib/gems/pending/util/miq-hash_struct.rb - About 1 hr to fix

Method to_h_simple has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def to_h_simple(options, hash = nil)
hash = {} if hash.nil?
 
each do |c|
e = (hash[options[:symbols] == false ? c.name.to_s : c.name] ||= []) << (options[:symbols] == false ? c.attributes&.stringify_keys : c.attributes)
Severity: Minor
Found in lib/gems/pending/util/xml/xml_hash.rb - About 1 hr to fix

Method disconnect has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def self.disconnect(mnt_point, logger = $log)
return if mnt_point.nil?
log_header = "MIQ(#{self.class.name}-disconnect)"
logger.info("#{log_header} Disconnecting mount point: #{mnt_point}") if logger
begin
Severity: Minor
Found in lib/gems/pending/util/mount/miq_generic_mount_session.rb - About 1 hr to fix

Method runProcess has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def runProcess(command, async = true, startup = {})
startup = {:ShowWindow => 1, :Title => "MIQ - #{Time.now.utc.iso8601}"}.merge(startup)
objStartup = @objWMI.Get("Win32_ProcessStartup").SpawnInstance_
startup.each_pair { |k, v| objStartup.send("#{k}=", v) }
 
 
Severity: Minor
Found in lib/gems/pending/util/win32/miq-wmi-mswin.rb - About 1 hr to fix

Method split_raw_line has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def self.split_raw_line(line)
line = line.to_s
return if line.empty?
 
time = line[11, 26]
Severity: Minor
Found in lib/gems/pending/util/miq_logger_processor.rb - About 1 hr to fix

Method to_png has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def self.to_png(data, options = {})
require 'gruff'
 
graph = case options[:graph_type]
when :line then Gruff::Line.new
Severity: Minor
Found in lib/gems/pending/util/miq_logger_processor.rb - About 1 hr to fix

Method walk has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def self.walk(node, parents = "")
tags = []
 
sep = "/"
case node.name
Severity: Minor
Found in lib/gems/pending/util/xml/xml_utils.rb - About 1 hr to fix

Method miq_record_change has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def miq_record_change(node, _delta, diff_elements, stats)
srcPath = node[0].nil? ? node[1] : node[0]
 
if node[1].nil?
action = :adds
Severity: Minor
Found in lib/gems/pending/util/xml/xml_diff.rb - About 1 hr to fix

Method remove has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def remove(log_uri)
log_header = "MIQ(#{self.class.name}-remove)"
 
unless self.log_uri_still_configured?(log_uri)
logger.info("#{log_header} Skipping remove because log URI: [#{log_uri}] does not originate from the currently configured base URI: [#{@settings[:uri]}]")
Severity: Minor
Found in lib/gems/pending/util/mount/miq_generic_mount_session.rb - About 1 hr to fix

Method miq_patch_process_element has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

def miq_patch_process_element(ele, data, path, compare_roots, direction, parent_node, node, xml, stats)
Severity: Major
Found in lib/gems/pending/util/xml/xml_patch.rb - About 1 hr to fix

Method findElementInt has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def self.findElementInt(paths, ele)
if paths.length > 0
searchStr = paths[0]
paths = paths[1..paths.length]
# puts "Search String: #{searchStr}"
Severity: Minor
Found in lib/gems/pending/util/xml/xml_hash.rb - About 1 hr to fix

Method to_xml has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def to_xml(xml = nil)
if xml.nil?
return REXML::Document.new(nil) if self[:name].nil?
xml = REXML::Document.new("<#{self[:name]}/>")
xml = xml.root
Severity: Minor
Found in lib/gems/pending/util/xml/xml_hash.rb - About 1 hr to fix

Method element2hash has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def self.element2hash(doc, path)
obj = {}
doc.find_each(path + "/*") do |element|
text = element.text
text = "" if text.nil?
Severity: Minor
Found in lib/gems/pending/util/xml/xml_utils.rb - About 1 hr to fix

Method verify_return_object has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def self.verify_return_object(xml)
return unless is_error_object?(xml)
err_msg = "#{name} "
node = xml.find_first("//*/Property[@Name=\"FullyQualifiedErrorId\"]")
err_msg << "(#{node.text}): " unless node.nil?
Severity: Minor
Found in lib/gems/pending/util/win32/miq-powershell.rb - About 1 hr to fix

Method findNamedElement has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def self.findNamedElement(findStr, ele)
ele.each_element do |e|
if e.name == "value" && e.attributes['name'].downcase == findStr.downcase
return e.text
end # if
Severity: Minor
Found in lib/gems/pending/util/xml/xml_utils.rb - About 1 hr to fix
Severity
Category
Status
Source
Language