Showing 28 of 54 total issues
Class Service
has 58 methods (exceeds 20 allowed). Consider refactoring. Open
class Service
include Logging
DEFAULT_OPTIONS = {}
REQUIRED_OPTIONS = [:server, :username, :password]
File event.rb
has 486 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Ovirt
class Event < Base
self.top_level_strings = [:description, :severity]
self.top_level_integers = [:code]
self.top_level_timestamps = [:time]
Class Base
has 46 methods (exceeds 20 allowed). Consider refactoring. Open
class Base
extend Logging
include Logging
def self.create_from_xml(service, xml)
File service.rb
has 371 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'nokogiri'
require 'openssl'
require 'rest-client'
require 'tempfile'
require 'uri'
Class Vm
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class Vm < Template
self.top_level_strings = [:name, :origin, :type, :description]
self.top_level_booleans = [:stateless]
self.top_level_integers = [:memory]
self.top_level_timestamps = [:creation_time, :start_time]
Method build_clone_xml
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def build_clone_xml(options)
builder = Nokogiri::XML::Builder.new do |xml|
xml.vm do
xml.name options[:name]
xml.cluster(:id => Base.object_to_id(options[:cluster]))
- Read upRead up
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
File vm.rb
has 304 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative 'legacy_support/cloud_init_via_floppy_payload'
module Ovirt
class Vm < Template
self.top_level_strings = [:name, :origin, :type, :description]
File base.rb
has 285 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Ovirt
class Base
extend Logging
include Logging
Method xml_to_hash
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.xml_to_hash(xml)
node = xml_to_nokogiri(xml)
hash = hash_from_id_and_href(node)
hash[:relationships] = xml_to_relationships(node)
hash[:actions] = xml_to_actions(node)
- Read upRead up
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 parse_node_extended
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.parse_node_extended(node, hash)
hash[:relationships][:host_nics] = hash[:relationships].delete(:nics)
parse_first_node(node, :certificate, hash,
:node => [:organization, :subject])
Method build_clone_xml
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_clone_xml(options)
builder = Nokogiri::XML::Builder.new do |xml|
xml.vm do
xml.name options[:name]
xml.cluster(:id => Base.object_to_id(options[:cluster]))
Method resource_verb
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def resource_verb(path, verb, *args)
log_header = "#{self.class.name}#resource_#{verb}"
resource = create_resource(path)
logger.info "#{log_header}: Sending URL: <#{resource.url}>"
logger.debug "#{log_header}: With args: <#{args.inspect}>"
- Read upRead up
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 api_uri
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def api_uri(path = nil)
# Calculate the complete URI:
uri = URI.join(base_uri, api_path).to_s
# The path passed to this method will have the "/api" prefix if it comes from the "ems_ref"
- Read upRead up
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_disk
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def create_disk(options = {})
create_device("disk") do |xml|
[:name, :interface, :format, :size, :type].each do |key|
next if options[key].blank?
xml.send("#{key}_", options[key])
- Read upRead up
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 resource_verb
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def resource_verb(path, verb, *args)
log_header = "#{self.class.name}#resource_#{verb}"
resource = create_resource(path)
logger.info "#{log_header}: Sending URL: <#{resource.url}>"
logger.debug "#{log_header}: With args: <#{args.inspect}>"
Method create_nic
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create_nic(options = {})
create_device("nic") do |xml|
xml.name options[:name]
xml.interface options[:interface] unless options[:interface].blank?
xml.network(:id => options[:network_id]) unless options[:network_id].blank?
- Read upRead up
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 apply_options!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def apply_options!(options)
update! do |xml|
xml.name options[:name] if options[:name]
xml.interface options[:interface] if options[:interface]
xml.network(:id => options[:network_id]) if options[:network_id]
- Read upRead up
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 probe_api_path
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def probe_api_path(uri, path)
uri = URI.join(uri, path)
request = RestClient::Resource.new(uri.to_s, :verify_ssl => OpenSSL::SSL::VERIFY_NONE)
begin
request.get
- Read upRead up
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 standard_collection
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def standard_collection(uri_suffix, element_name = nil, paginate = false, sort_by = :name, direction = :asc)
Method paginate_resource_get
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def paginate_resource_get(path = nil, sort_by = :name, direction = :asc)
log_header = "#{self.class.name}#paginate_resource_get"
page = 1
full_xml = nil
loop do
- Read upRead up
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"