ManageIQ/manageiq-gems-pending

View on GitHub

Showing 217 of 217 total issues

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

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

def create_directory_structure(directory_path)
pwd = ftp.pwd
directory_path.to_s.split('/').each do |directory|
unless ftp.nlst.include?(directory)
_log.info("creating #{directory}")
Severity: Minor
Found in lib/gems/pending/util/miq_ftp_lib.rb - About 1 hr to fix

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

def fru_info
return @devices unless @devices.nil?
 
@devices = []
dev_id = nil
Severity: Minor
Found in lib/gems/pending/util/miq-ipmi.rb - About 1 hr to fix

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

def process_hash(node)
hsh = {}
node.each_element do |e|
# Nokogiri starts its element indexing at 0, while others start at 1.
index1 = MiqXml.nokogiri? ? 0 : 1
Severity: Minor
Found in lib/gems/pending/util/win32/miq-powershell.rb - About 1 hr to fix

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

def self.tail(filename, last)
return nil unless File.file?(filename)
 
lines = nil
if Sys::Platform::OS == :unix
Severity: Minor
Found in lib/gems/pending/util/miq-system.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_utils.rb - About 1 hr to fix

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

def self.findNamedElement_hash(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

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

def self.process_list_wmi(wmi = nil, pid = nil)
pl = {}
wmi = WMIHelper.connectServer if wmi.nil?
os_data = wmi.get_instance('select TotalVisibleMemorySize from Win32_OperatingSystem')
proc_query = 'select PageFileUsage,Name,Handle,WorkingSetSize,Priority,UserModeTime,KernelModeTime from Win32_Process'
Severity: Minor
Found in lib/gems/pending/util/miq-process.rb - About 1 hr to fix

Method initialize has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def initialize(first, second = nil, parent = nil)
@normalized = @unnormalized = @element = nil
if first.kind_of? Attribute
self.name = first.expanded_name
@value = first.value
Severity: Minor
Found in lib/gems/pending/util/xml/miq_rexml.rb - About 1 hr to fix

Method miq_patch_process_element has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def miq_patch_process_element(ele, data, path, compare_roots, direction, parent_node, node, xml, stats)
if compare_roots == true
ele = xml.root
else
if node == :updates || direction == XML_DIFF_DEL
Severity: Minor
Found in lib/gems/pending/util/xml/xml_patch.rb - About 55 mins to fix

Method log_require has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def log_require(path, mode, timing = nil, memory_consumed = nil, features_loaded = nil)
$req_depth -= 1 if mode == true || mode == false || mode == :fail
$req_log.puts "#{$req_depth.to_s.rjust(3)} #{REQ_LOG_OPERS[mode]} #{REQ_LOG_TREE * $req_depth}#{path.inspect[1..-2]}#{timing.nil? ? '' : " (#{"%.6f seconds" % timing})"}#{memory_consumed.nil? ? '' : " (#{memory_consumed} KB)"}#{features_loaded.nil? ? '' : " (#{features_loaded} features loaded)"}"
$req_depth += 1 if mode == :enter || mode == :reenter
end
Severity: Minor
Found in lib/gems/pending/util/require_with_logging.rb - About 55 mins to fix

Method to_png has a Cognitive Complexity of 9 (exceeds 5 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 55 mins to fix

Method read_single_chunk has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def read_single_chunk(chunksize = DEFAULT_CHUNKSIZE)
@buf_left ||= byte_count
return DONE_READING.dup unless @buf_left.nil? || @buf_left.positive?
cur_readsize = if @buf_left.nil? || @buf_left - chunksize >= 0
chunksize
Severity: Minor
Found in lib/gems/pending/util/miq_object_storage.rb - About 45 mins to fix

Method [] has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def [](index, _name = nil)
if index.kind_of? Integer
raise "index (#{index}) must be >= 1" if index < 1
return @element.children[index - 1]
else
Severity: Minor
Found in lib/gems/pending/util/xml/xml_hash.rb - About 45 mins to fix
Severity
Category
Status
Source
Language