Showing 218 of 218 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]}]")
- Create a ticketCreate a ticket
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)
- Create a ticketCreate a ticket
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
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
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}"
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
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
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
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
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
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
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
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?
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
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'
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
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
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
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
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
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}")
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
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?
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
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}"
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
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
- Create a ticketCreate a ticket
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
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
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
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
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
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method each_element_with_attribute
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def each_element_with_attribute(key, value = nil, max = 0, _name = nil, &_block) # :yields: Element
# Note: optional "name" parameter is not implemented here.
eCount = 0
each do |e|
if e.attributes.key?(key) && (value.nil? || e.attributes[key] == value)
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method run_command
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def run_command(ipmi_cmd, *args)
# -E: The remote server password is specified by the environment variable IPMI_PASSWORD.
continue_on_error = args.pop if [true, false, nil].any? { |type| args.last == type }
continue_on_error ||= false
ENV['IPMI_PASSWORD'] = @password
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"