fog/fog-vsphere

View on GitHub

Showing 128 of 128 total issues

Method list_child_snapshots has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def list_child_snapshots(_snapshot, _opts = {})
          [
            {
              name: 'clean',
              quiesced: false,
Severity: Minor
Found in lib/fog/vsphere/requests/compute/list_child_snapshots.rb - About 1 hr to fix

    Method vm_reconfig_cdrom has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def vm_reconfig_cdrom(options = {})
              raise ArgumentError, 'instance_uuid is a required parameter' unless options.key? 'instance_uuid'
              # Attach iso / disattach
              if options.key?('iso')
                raise ArgumentError, 'datastore is a required parameter' unless options.key? 'datastore'
    Severity: Minor
    Found in lib/fog/vsphere/requests/compute/vm_reconfig_cdrom.rb - About 1 hr to fix

      Method get_vm_ref has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

              def get_vm_ref(id, dc = nil, folder = nil, recursive = false)
                raw_datacenter = find_raw_datacenter(dc) if dc
                vm = case is_uuid?(id)
                       # UUID based
                     when true
      Severity: Minor
      Found in lib/fog/vsphere/requests/compute/get_virtual_machine.rb - About 55 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 choose_finder has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

              def choose_finder(ref_or_name, distributedswitch)
                case distributedswitch
                when String
                  # only the one will do
                  proc do |n|
      Severity: Minor
      Found in lib/fog/vsphere/requests/compute/get_network.rb - About 55 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_migrate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

              def vm_migrate(options = {})
                # priority is the only required option, and it has a sane default option.
                priority = options['priority'].nil? ? 'defaultPriority' : options['priority']
                raise ArgumentError, 'instance_uuid is a required parameter' unless options.key? 'instance_uuid'
      
      
      Severity: Minor
      Found in lib/fog/vsphere/requests/compute/vm_migrate.rb - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
      Open

              def vm_reconfig_cdrom(options = {})
                raise ArgumentError, 'instance_uuid is a required parameter' unless options.key? 'instance_uuid'
                # Attach iso / disattach
                if options.key?('iso')
                  raise ArgumentError, 'datastore is a required parameter' unless options.key? 'datastore'
      Severity: Minor
      Found in lib/fog/vsphere/requests/compute/vm_reconfig_cdrom.rb - About 55 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_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

                      Severity
                      Category
                      Status
                      Source
                      Language