ManageIQ/manageiq-gems-pending

View on GitHub

Showing 217 of 217 total issues

File xml_hash.rb has 461 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'rexml/document'
require 'active_support/core_ext/hash/keys'
 
module XmlHash
class Element < Hash
Severity: Minor
Found in lib/gems/pending/util/xml/xml_hash.rb - About 7 hrs to fix

Class MiqGenericMountSession has 45 methods (exceeds 20 allowed). Consider refactoring.
Open

class MiqGenericMountSession < MiqFileStorage::Interface
class NoSuchFileOrDirectory < RuntimeError; end
 
class << self
def run_command(command, args)
Severity: Minor
Found in lib/gems/pending/util/mount/miq_generic_mount_session.rb - About 6 hrs to fix

Method disk_usage has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

def self.disk_usage(file = nil)
file = normalize_df_file_argument(file)
 
case Sys::Platform::IMPL
when :linux
Severity: Minor
Found in lib/gems/pending/util/miq-system.rb - About 6 hrs to fix

Class Element has 43 methods (exceeds 20 allowed). Consider refactoring.
Open

class Element < Hash
include Enumerable
 
def initialize(name, attrs = {}, parent = nil)
super()
Severity: Minor
Found in lib/gems/pending/util/xml/xml_hash.rb - About 5 hrs to fix

File miq_generic_mount_session.rb has 397 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'active_support/core_ext/object/blank'
require 'fileutils'
require 'logger'
require 'sys-uname'
require 'uri'
Severity: Minor
Found in lib/gems/pending/util/mount/miq_generic_mount_session.rb - About 5 hrs to fix

Method miq_patch_elements has a Cognitive Complexity of 33 (exceeds 5 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 4 hrs to fix

Class Document has 27 methods (exceeds 20 allowed). Consider refactoring.
Open

class Document < Hash
include MiqXmlDiff
include MiqXmlPatch
 
def initialize(name = "xml", _attrs = {}, _parent = nil)
Severity: Minor
Found in lib/gems/pending/util/xml/xml_hash.rb - About 3 hrs to fix

Class MiqIPMI has 26 methods (exceeds 20 allowed). Consider refactoring.
Open

class MiqIPMI
def initialize(server = nil, username = nil, password = nil)
@server = server
@username = username
@password = password
Severity: Minor
Found in lib/gems/pending/util/miq-ipmi.rb - About 3 hrs to fix

Method parse_output has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
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 - About 2 hrs to fix

Cyclomatic complexity for disk_usage is too high. [18/11]
Open

def self.disk_usage(file = nil)
file = normalize_df_file_argument(file)
 
case Sys::Platform::IMPL
when :linux
Severity: Minor
Found in lib/gems/pending/util/miq-system.rb by rubocop

Method walk has a Cognitive Complexity of 18 (exceeds 5 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 2 hrs to fix

Cyclomatic complexity for to_png is too high. [17/11]
Open

def self.to_png(data, options = {})
require 'gruff'
 
graph = case options[:graph_type]
when :line then Gruff::Line.new

File miq_rexml.rb has 265 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'time'
require 'rexml/document'
require_relative 'xml_utils'
 
class MIQRexml
Severity: Minor
Found in lib/gems/pending/util/xml/miq_rexml.rb - About 2 hrs to fix

File miq-powershell.rb has 261 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'awesome_spawn'
require 'io/wait'
require 'open-uri'
 
# Not to be confused with our own win32 directory, this is in stdlib on windows
Severity: Minor
Found in lib/gems/pending/util/win32/miq-powershell.rb - About 2 hrs to fix

Method linux_process_stat has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def self.linux_process_stat(pid = nil)
pid ||= Process.pid
 
filename = "/proc/#{pid}/stat"
raise Errno::ESRCH.new(pid.to_s) unless File.exist?(filename)
Severity: Major
Found in lib/gems/pending/util/miq-process.rb - About 2 hrs to fix

Method disk_usage has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def self.disk_usage(file = nil)
file = normalize_df_file_argument(file)
 
case Sys::Platform::IMPL
when :linux
Severity: Major
Found in lib/gems/pending/util/miq-system.rb - About 2 hrs to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

def mount_share
super
 
log_header = "MIQ(#{self.class.name}-mount_share)"
logger.info("#{log_header} Connecting to host: [#{@host}], share: [#{@mount_path}] using mount point: [#{@mnt_point}]...")
Severity: Major
Found in lib/gems/pending/util/mount/miq_nfs_session.rb and 1 other location - About 2 hrs to fix
lib/gems/pending/util/mount/miq_glusterfs_session.rb on lines 18..39

Similar blocks of code found in 2 locations. Consider refactoring.
Open

def mount_share
super
 
log_header = "MIQ(#{self.class.name}-mount_share)"
logger.info(
Severity: Major
Found in lib/gems/pending/util/mount/miq_glusterfs_session.rb and 1 other location - About 2 hrs to fix
lib/gems/pending/util/mount/miq_nfs_session.rb on lines 17..39

Method miq_compare_elements has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

def miq_compare_elements(node1, node2, delta, diff_elements, stats)
node1.each_element do |e1|
e2 = miq_find_element(e1, node2)
if e2
if miq_compare_attributes(e1, e2) == false
Severity: Minor
Found in lib/gems/pending/util/xml/xml_diff.rb - About 1 hr to fix

Method convert_type has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
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'
Severity: Minor
Found in lib/gems/pending/util/win32/miq-powershell.rb - About 1 hr to fix
Severity
Category
Status
Source
Language