ManageIQ/ovirt

View on GitHub
lib/ovirt/base.rb

Summary

Maintainability
C
1 day
Test Coverage
C
77%

Class Base has 46 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Base
    extend Logging
    include Logging

    def self.create_from_xml(service, xml)
Severity: Minor
Found in lib/ovirt/base.rb - About 6 hrs to fix

    File base.rb has 285 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Ovirt
      class Base
        extend Logging
        include Logging
    
    
    Severity: Minor
    Found in lib/ovirt/base.rb - About 2 hrs to fix

      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)
      Severity: Minor
      Found in lib/ovirt/base.rb - About 1 hr 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 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

      There are no issues that match your filters.

      Category
      Status