fog/fog-vsphere

View on GitHub

Showing 93 of 128 total issues

Method create_vm_on_storage_pod has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def create_vm_on_storage_pod(vm_pod_name, volumes, vm_cfg, vmFolder, resource_pool, datacenter, host = nil)
Severity: Major
Found in lib/fog/vsphere/requests/compute/create_vm.rb - About 50 mins to fix

    Avoid deeply nested control flow statements.
    Open

                      custom_spec['nicSettingMap'][0] = {} if custom_spec['nicSettingMap'].empty?
    Severity: Major
    Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                      raise ArgumentError, 'identification->domainAdminPassword->plainText is required when using Sysprep identity and identification -> joinDomain' unless identity['Sysprep']['identification']['domainAdminPassword'].key?('plainText')
      Severity: Major
      Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                        raise ArgumentError, 'guiUnattended->password->plainText is required when using Sysprep identity and guiUnattended -> password' unless identity['Sysprep']['guiUnattended']['password'].key?('plainText')
        Severity: Major
        Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                          raise ArgumentError, 'identification->domainAdmin is required when using Sysprep identity and identification -> joinDomain' unless identity['Sysprep']['identification'].key?('domainAdmin')
          Severity: Major
          Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                            raise ArgumentError, 'licenseFilePrintData->autoMode is required when using Sysprep identity and licenseFilePrintData' unless identity['Sysprep']['licenseFilePrintData'].key?('autoMode')
            Severity: Major
            Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

              Method initialize_scsi_controllers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                      def initialize_scsi_controllers
                        if attributes[:scsi_controllers] && attributes[:scsi_controllers].is_a?(Array)
                          attributes[:scsi_controllers].map! do |controller|
                            controller.is_a?(Hash) ? Fog::Vsphere::Compute::SCSIController.new(controller) : controller
                          end
              Severity: Minor
              Found in lib/fog/vsphere/models/compute/server.rb - About 45 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 pod_selection_spec has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                      def pod_selection_spec(vm_pod_name, disks_per_pod, datacenter, with_relocation: false, only_volumes: false)
                        raw_pods = {}
                        raw_pods[vm_pod_name] = get_raw_storage_pod(vm_pod_name, datacenter)
                        disks_per_pod.each_key { |pod_name| raw_pods[pod_name] ||= get_raw_storage_pod(pod_name, datacenter) }
              
              
              Severity: Minor
              Found in lib/fog/vsphere/requests/compute/create_vm.rb - About 45 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

              Avoid deeply nested control flow statements.
              Open

                                custom_spec['nicSettingMap'][0]['adapter']['ip'] = custom_spec['ipsettings']['ip'] if custom_spec['ipsettings'].key?('ip')
              Severity: Major
              Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                raise ArgumentError, 'identification->domainAdminPassword->value is required when using Sysprep identity and identification -> joinDomain' unless identity['Sysprep']['identification']['domainAdminPassword'].key?('value')
                Severity: Major
                Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                  Method folder_enumerator has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def folder_enumerator(raw_folder, recursive)
                            Enumerator.new do |yielder|
                              raw_folder.children.each do |child|
                                case child
                                when RbVmomi::VIM::Folder
                  Severity: Minor
                  Found in lib/fog/vsphere/requests/compute/list_virtual_machines.rb - About 45 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 vm_reconfig_cdrom has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def vm_reconfig_cdrom(options = {})
                            raise ArgumentError, 'instance_uuid is a required parameter' unless options.key? 'instance_uuid'
                            if options.key?('iso')
                              raise ArgumentError, 'datastore is a required parameter' unless options.key? 'datastore'
                              backing = {
                  Severity: Minor
                  Found in lib/fog/vsphere/requests/compute/vm_reconfig_cdrom.rb - About 45 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 save has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def save
                            requires :instance_uuid
                  
                            if unit_number.nil?
                              used_unit_numbers = server.cdroms.map(&:unit_number)
                  Severity: Minor
                  Found in lib/fog/vsphere/models/compute/cdrom.rb - About 45 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 vm_execute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def vm_execute(options = {})
                            raise ArgumentError, 'instance_uuid is a required parameter' unless options.key? 'instance_uuid'
                            raise ArgumentError, 'command is a required parameter' unless options.key? 'command'
                            raise ArgumentError, 'user is a required parameter' unless options.key? 'user'
                            raise ArgumentError, 'password is a required parameter' unless options.key? 'password'
                  Severity: Minor
                  Found in lib/fog/vsphere/requests/compute/vm_execute.rb - About 45 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

                  Avoid deeply nested control flow statements.
                  Open

                                raise ArgumentError, 'SysprepText -> value is required when using SysprepText identity' unless identity['SysprepText'].key?('value')
                  Severity: Major
                  Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                      custom_spec['nicSettingMap'][0]['adapter'] = {} unless custom_spec['nicSettingMap'][0].key?('adapter')
                    Severity: Major
                    Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                        custom_spec['nicSettingMap'][0]['adapter']['gateway'] = custom_spec['ipsettings']['gateway'] if custom_spec['ipsettings'].key?('gateway')
                      Severity: Major
                      Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                          custom_spec['nicSettingMap'][0]['adapter']['subnetMask'] = custom_spec['ipsettings']['subnetMask'] if custom_spec['ipsettings'].key?('subnetMask')
                        Severity: Major
                        Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                          raise ArgumentError, 'guiUnattended->password->value is required when using Sysprep identity and guiUnattended -> password' unless identity['Sysprep']['guiUnattended']['password'].key?('value')
                          Severity: Major
                          Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                              custom_spec['nicSettingMap'][0]['adapter']['dnsServerList'] = custom_spec['ipsettings']['dnsServerList'] if custom_spec['ipsettings'].key?('dnsServerList')
                            Severity: Major
                            Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language