fog/fog-vsphere

View on GitHub

Showing 94 of 130 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

                        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, 'commandList is required when using Sysprep identity and guiRunOnce' unless identity['Sysprep']['guiRunOnce'].key?('commandList')
        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

                                custom_spec['nicSettingMap'][0]['adapter']['dnsDomain'] = custom_spec['ipsettings']['domain'] if custom_spec['ipsettings'].key?('domain')
              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

                                  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

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

                            def list_hosts(filters = {})
                              cluster = get_raw_cluster(filters[:cluster], filters[:datacenter])
                    
                              results = property_collector_results(host_system_filter_spec(cluster))
                    
                    
                    Severity: Minor
                    Found in lib/fog/vsphere/requests/compute/list_hosts.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, "Unsupported autoMode, supported modes are : 'perSeat' or 'perServer'" unless %w[perSeat perServer].include? identity['Sysprep']['licenseFilePrintData']['autoMode']
                    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

                        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

                        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 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

                        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

                          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

                                                raise ArgumentError, 'SubnetMask is required when assigning static IPv6 when using nicSettingMap -> Adapter -> ipV6Spec' unless nic['adapter']['ipV6Spec'].key?('subnetMask')
                            Severity: Major
                            Found in lib/fog/vsphere/requests/compute/vm_clone.rb - About 45 mins to fix

                              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, '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
                                Severity
                                Category
                                Status
                                Source
                                Language