Showing 248 of 460 total issues

Method get_supported_versions has 1129 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def get_supported_versions
          body =
            {:xmlns=>"http://www.vmware.com/vcloud/versions",
             :xmlns_xsi=>xmlns_xsi,
             :xsi_schemaLocation=>xsi_schema_location,
Severity: Major
Found in lib/fog/vcloud_director/requests/compute/get_supported_versions.rb - About 5 days to fix

    File get_supported_versions.rb has 1150 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Fog
      module Compute
        class VcloudDirector
          class Real
            # List all supported versions.
    Severity: Major
    Found in lib/fog/vcloud_director/requests/compute/get_supported_versions.rb - About 2 days to fix

      Method build_source_items has a Cognitive Complexity of 144 (exceeds 5 allowed). Consider refactoring.
      Open

                def build_source_items(xml)
                  vms = @configuration[:source_vms]
                  vms.each do |vm|
                    xml.SourcedItem {
                      xml.Source(:name =>vm[:name], :href => vm[:href])
      Severity: Minor
      Found in lib/fog/vcloud_director/generators/compute/compose_common.rb - About 2 days 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 generate_xml has a Cognitive Complexity of 140 (exceeds 5 allowed). Consider refactoring.
      Open

                def generate_xml
                  body = Nokogiri::XML::Builder.new do
                    attrs = {
                      :xmlns => 'http://www.vmware.com/vcloud/v1.5',
                      :name  => options[:name]
      Severity: Minor
      Found in lib/fog/vcloud_director/generators/compute/org_vdc_network.rb - About 2 days 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 generate_xml has a Cognitive Complexity of 108 (exceeds 5 allowed). Consider refactoring.
      Open

                def generate_xml
                  body = Nokogiri::XML::Builder.new do |xml|
                    attrs = {
                      :xmlns => 'http://www.vmware.com/vcloud/v1.5',
                      'xmlns:ovf' => 'http://schemas.dmtf.org/ovf/envelope/1'
      Severity: Minor
      Found in lib/fog/vcloud_director/generators/compute/network_config_section.rb - About 2 days 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

      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 all_types has 328 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def all_types
                  {:xmlns=>xmlns,
                   :xmlns_xsi=>xmlns_xsi,
                   :type=>"application/vnd.vmware.vcloud.query.queryList+xml",
                   :href=>make_href('query'),
        Severity: Major
        Found in lib/fog/vcloud_director/requests/compute/get_execute_query.rb - About 1 day to fix

          Method post_instantiate_vapp_template has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring.
          Open

                  def post_instantiate_vapp_template(id, vapp_template_id, name, options={})
                    body = Nokogiri::XML::Builder.new do
                      attrs = {
                        'xmlns' => 'http://www.vmware.com/vcloud/v1.5',
                        'xmlns:ovf' => 'http://schemas.dmtf.org/ovf/envelope/1',

          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 get_execute_query.rb has 630 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          module Fog
            module Compute
              class VcloudDirector
                class Real
                  # REST API General queries handler.
          Severity: Major
          Found in lib/fog/vcloud_director/requests/compute/get_execute_query.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 generate_configure_vm_request has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
              Open

                      def generate_configure_vm_request(vm_data)
                        xmlns = 'http://schemas.dmtf.org/ovf/envelope/1'
                        xmlns_vcloud = 'http://www.vmware.com/vcloud/v1'
                        xmlns_rasd = 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData'
                        xmlns_vssd = 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData'
              Severity: Minor
              Found in lib/fog/vcloud/requests/compute/configure_vm.rb - About 1 day 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 vm_allocate has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
              Open

                      def vm_allocate(attr={ })
              
                        if(attr[:flavor].nil?)
                          raise(ArgumentError.new("Attribute flavor is nil! #{attr.inspect}"))
                        end
              Severity: Minor
              Found in lib/fog/opennebula/requests/compute/vm_allocate.rb - About 1 day 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 fetch_items has 216 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def fetch_items(type, opts)
                        if opts.key?(:filter) && opts[:filter] =~ /^name==([^;,]+)$/
                          name = $1
                        elsif type == 'vAppTemplate' && opts.key?(:filter) &&
                          opts[:filter] =~ /^name==([^;,]+);catalogName==([^;,]+)$/ #TODO also match in other order
              Severity: Major
              Found in lib/fog/vcloud_director/requests/compute/get_execute_query.rb - About 1 day to fix

                Method get_supported_systems_info has 208 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        def get_supported_systems_info
                          body = # this is a subset of the full list
                            {:xmlns=>xmlns,
                             :xmlns_xsi=>xmlns_xsi,
                             :type=>"application/vnd.vmware.vcloud.supportedSystemsInfo+xml",

                  Method build_firewall_service has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
                  Open

                            def build_firewall_service(xml)
                              firewall_config = @configuration[:FirewallService]
                              return unless firewall_config
                  
                              xml.FirewallService {

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

                          def put_guest_customization_section_vapp(id, options={})
                            options = options.dup
                  
                            # Mutate options to new format.
                            deprecated = {

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

                          def fetch_items(type, opts)
                            if opts.key?(:filter) && opts[:filter] =~ /^name==([^;,]+)$/
                              name = $1
                            elsif type == 'vAppTemplate' && opts.key?(:filter) &&
                              opts[:filter] =~ /^name==([^;,]+);catalogName==([^;,]+)$/ #TODO also match in other order
                  Severity: Minor
                  Found in lib/fog/vcloud_director/requests/compute/get_execute_query.rb - About 6 hrs 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 template_pool has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def template_pool(filter = { })
                  
                            templates = ::OpenNebula::TemplatePool.new(client)
                            if filter[:id].nil?
                              templates.info!(-2,-1,-1)
                  Severity: Minor
                  Found in lib/fog/opennebula/requests/compute/template_pool.rb - About 6 hrs 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 list_vms has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def list_vms(filter={})
                            vms=[]
                            vmpool = ::OpenNebula::VirtualMachinePool.new(client)
                            if filter[:id].nil?
                              vmpool.info!(-2,-1,-1,-1)
                  Severity: Minor
                  Found in lib/fog/opennebula/requests/compute/list_vms.rb - About 5 hrs 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

                  Class Server has 38 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                        class Server < Fog::Vcloud::Model
                          include Fog::Vcloud::Compute::Helpers::Status
                  
                          identity :href, :aliases => :Href
                          attribute :links, :aliases => :Link, :type => :array
                  Severity: Minor
                  Found in lib/fog/vcloud/models/compute/server.rb - About 5 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language