ManageIQ/ovirt

View on GitHub

Showing 28 of 54 total issues

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
Severity: Minor
Found in lib/ovirt/service.rb - About 35 mins to fix

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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def self.parse_node_extended(node, hash)
      parse_first_node(node, :status,  hash, :node => [:state])
      parse_first_node(node, :storage, hash, :node => [:type, :address, :path])
      parse_first_node(node, :storage, hash, :attribute => [:id])

Severity: Minor
Found in lib/ovirt/storage_domain.rb - About 35 mins to fix

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 operation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def operation(method, *_args)
      if @operations.key?(method.to_sym)
        builder = Nokogiri::XML::Builder.new do |xml|
          xml.action { yield xml if block_given? }
        end
Severity: Minor
Found in lib/ovirt/base.rb - About 25 mins to fix

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_new_disks_from_template has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def create_new_disks_from_template(vm, options)
      disks.each do |disk_object|
        disk_options            = disk_object.attributes_for_new_disk
        disk_options[:sparse]   = options[:sparse]  unless options[:sparse].nil?
        disk_options[:storage]  = options[:storage] unless options[:storage].blank?
Severity: Minor
Found in lib/ovirt/template.rb - About 25 mins to fix

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 start has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def start
      if block_given?
        operation(:start) { |xml| yield xml }
      else
        operation(:start)
Severity: Minor
Found in lib/ovirt/vm.rb - About 25 mins to fix

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 clone_to_vm has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def clone_to_vm(options)
      # Create a VM based on this template
      REQUIRED_CLONE_PARAMETERS.each do |key|
        raise ArgumentError, "#{key.inspect} cannot be blank" if options[key].blank?
      end
Severity: Minor
Found in lib/ovirt/template.rb - About 25 mins to fix

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 getCfg has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def getCfg(_snap = nil)
      # TODO: Remove the following MiqException and any others
      raise MiqException::MiqVimError, "Failed to retrieve configuration information for VM" if attributes.nil?

      cfg_hash = {}
Severity: Minor
Found in lib/ovirt/template.rb - About 25 mins to fix

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 relationship has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def relationship(rel)
      if @relationships.key?(rel.to_sym)
        rel_str  = rel.to_s
        rel_str  = 'storage_domains' if rel_str == 'storagedomains'
        rel_str  = 'data_centers'    if rel_str == 'datacenters'
Severity: Minor
Found in lib/ovirt/base.rb - About 25 mins to fix

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

Severity
Category
Status
Source
Language