lib/fog/vcloud_director/compute.rb

Summary

Maintainability
F
3 days
Test Coverage

File compute.rb has 801 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'fog/vcloud_director/core'
require 'fog/vcloud_director/query'

class VcloudDirectorParser < Fog::Parsers::Base
  def extract_attributes(attributes_xml)
Severity: Major
Found in lib/fog/vcloud_director/compute.rb - About 1 day to fix

    Method data has 245 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def data
              @@data ||= Hash.new do |hash, key|
    
                vdc1_uuid = uuid
                vdc2_uuid = uuid
    Severity: Major
    Found in lib/fog/vcloud_director/compute.rb - About 1 day to fix

      Method do_request has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

              def do_request(params)
                headers = {
                  'Accept' => "application/*+xml;version=#{@api_version}",
                  'x-vcloud-authorization' => vcloud_token
                }
      Severity: Minor
      Found in lib/fog/vcloud_director/compute.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 do_request has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def do_request(params)
                headers = {
                  'Accept' => "application/*+xml;version=#{@api_version}",
                  'x-vcloud-authorization' => vcloud_token
                }
      Severity: Minor
      Found in lib/fog/vcloud_director/compute.rb - About 1 hr to fix

        Method ensure_list! has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

                def ensure_list!(hash, key1, key2=nil)
                  if key2.nil?
                    hash[key1] ||= []
                    hash[key1] = [hash[key1]] if hash[key1].is_a?(Hash)
                  else
        Severity: Minor
        Found in lib/fog/vcloud_director/compute.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 extract_attributes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def extract_attributes(attributes_xml)
            attributes = {}
            until attributes_xml.empty?
              if attributes_xml.first.is_a?(Array)
                until attributes_xml.first.empty?
        Severity: Minor
        Found in lib/fog/vcloud_director/compute.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

        There are no issues that match your filters.

        Category
        Status