ManageIQ/manageiq-gems-pending

View on GitHub

Showing 217 of 217 total issues

Cyclomatic complexity for convert_type is too high. [13/11]
Open

def convert_type(c)
case c.name.to_sym
when :U16, :U32, :I32, :U64, :I64, :D, :By then c.text.to_i
when :Db then c.text.to_f
when :B then c.text.downcase == 'true'

Cyclomatic complexity for miq_patch_elements is too high. [12/11]
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]

Cyclomatic complexity for parse_output is too high. [12/11]
Open

def parse_output(cmd_text)
last_key = nil
lines = cmd_text.kind_of?(Array) ? cmd_text : cmd_text.split("\n")
lines.inject({}) do |a, line|
idx = line.index(": ")
Severity: Minor
Found in lib/gems/pending/util/miq-ipmi.rb by rubocop

Method miq_record_change has a Cognitive Complexity of 14 (exceeds 5 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 initialize has a Cognitive Complexity of 14 (exceeds 5 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 cpu_usage has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def self.cpu_usage
if Sys::Platform::IMPL == :linux
filename = "/var/www/miq/vmdb/log/vmstat_output.log"
 
begin
Severity: Minor
Found in lib/gems/pending/util/miq-system.rb - About 1 hr to fix

Method verify has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def verify
log_header = "MIQ(#{self.class.name}-verify)"
logger.info("#{log_header} [#{@settings[:uri]}]...")
res = true
 
 
Severity: Minor
Found in lib/gems/pending/util/mount/miq_generic_mount_session.rb - About 1 hr to fix

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
Severity
Category
Status
Source
Language