Showing 248 of 460 total issues

Method get_vms_in_lease_from_query has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        def get_vms_in_lease_from_query(options={})
          query = []
          query << "sortAsc=#{options[:sortAsc]}" if options[:sortAsc]
          query << "sortDesc=#{options[:sortDesc]}" if options[:sortDesc]
          query << "page=#{options[:page]}" if options[:page]

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

        def list_groups(filter={})
          groups = []
          net1 = mock_group "1", 'net1'
          net2 = mock_group "2", 'fogtest'

Severity: Minor
Found in lib/fog/opennebula/requests/compute/list_groups.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 list_groups has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        def list_groups(filter = {})

          groups=[]
          grouppool = ::OpenNebula::GroupPool.new(client)
          grouppool.info
Severity: Minor
Found in lib/fog/opennebula/requests/compute/list_groups.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 get_vapps_in_lease_from_query has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        def get_vapps_in_lease_from_query(options={})
          query = []
          query << "sortAsc=#{options[:sortAsc]}" if options[:sortAsc]
          query << "sortDesc=#{options[:sortDesc]}" if options[:sortDesc]
          query << "page=#{options[:page]}" if options[:page]

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

        def get_vapp_templates_from_query(options={})
          query = []
          query << "sortAsc=#{options[:sortAsc]}" if options[:sortAsc]
          query << "sortDesc=#{options[:sortDesc]}" if options[:sortDesc]
          query << "page=#{options[:page]}" if options[:page]

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

        def get_execute_query(type=nil, options={})
          if type.nil?
            response = request(
              :expects    => 200,
              :idempotent => true,
Severity: Minor
Found in lib/fog/vcloud_director/requests/compute/get_execute_query.rb - About 1 hr to fix

    Method mock_data has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def self.mock_data
              {
                :volumes => {},
                :servers => {},
                :vlans => {},
    Severity: Minor
    Found in lib/fog/cloudsigma/mock_data.rb - About 1 hr to fix

      Method build_vpn has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                def build_vpn(xml)
                  vpn_config = @configuration[:GatewayIpsecVpnService]
                  return unless vpn_config
      
                  xml.GatewayIpsecVpnService {

        Method post_clone_media has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def post_clone_media(vdc_id, source_id, options={})
                  # TODO: check this happens.
                  unless source_media = data[:medias][source_id]
                    raise Fog::Compute::VcloudDirector::Forbidden.new(
                      "No access to entity \"(com.vmware.vcloud.entity.media:#{source_id})\"."
        Severity: Minor
        Found in lib/fog/vcloud_director/requests/compute/post_clone_media.rb - About 1 hr to fix

          Method task_body has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def task_body(id)
                    task = data[:tasks][id]
          
                    body = {
                      :href => make_href("tasks/#{id}"),
          Severity: Minor
          Found in lib/fog/vcloud_director/requests/compute/get_task.rb - About 1 hr to fix

            Method post_capture_vapp has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def post_capture_vapp(vdc_id, name, source_id, 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',
            Severity: Minor
            Found in lib/fog/vcloud_director/requests/compute/post_capture_vapp.rb - About 1 hr to fix

              Method start has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def start
                      if is_running?
                          message="VNC server already running"
                          STDERR.puts message
                          @logger.info message
              Severity: Minor
              Found in lib/fog/opennebula/requests/compute/OpenNebulaVNC.rb - About 1 hr to fix

                Method end_element has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                          def end_element(name)
                            parse_end_element name, @response[:vm]
                            case name
                            when 'IpAddress'
                              @response[:vm][:ip_address] = value
                Severity: Minor
                Found in lib/fog/vcloud_director/parsers/compute/vm.rb - About 1 hr to fix

                  Method mount_volume has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          def mount_volume(volume, device = 'virtio', dev_channel = nil, boot_order = nil)
                            unless dev_channel
                              specified_channels = self.volumes.map { |v| v.dev_channel }.sort
                              if specified_channels
                                controller, controller_channel = 0, 0
                  Severity: Minor
                  Found in lib/fog/cloudsigma/models/server.rb - About 1 hr to fix

                    Method list_vms has 36 lines of code (exceeds 25 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 1 hr to fix

                      Method post_update_vapp_template_metadata has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def post_update_vapp_template_metadata(id, metadata={})
                                body = Nokogiri::XML::Builder.new do
                                  attrs = {
                                    :xmlns => 'http://www.vmware.com/vcloud/v1.5',
                                    'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance'

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

                              def modify_instance(instance_id, params={})
                                response = Excon::Response.new
                                if instance_exists? instance_id
                                  if params['state'] == 'restart'
                                    self.data[:instances][instance_id]["status"] = "8"
                      Severity: Minor
                      Found in lib/fog/ibm/requests/compute/modify_instance.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 post_update_catalog_item_metadata has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def post_update_catalog_item_metadata(id, metadata={})
                                body = Nokogiri::XML::Builder.new do
                                  attrs = {
                                    :xmlns => 'http://www.vmware.com/vcloud/v1.5',
                                    'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance'

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

                              def post_update_disk_metadata(id, metadata={})
                                body = Nokogiri::XML::Builder.new do
                                  attrs = {
                                    :xmlns => 'http://www.vmware.com/vcloud/v1.5',
                                    'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance'

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

                              def self.slurp(error, service=nil)
                                major_error_code = nil
                                message = nil
                                minor_error_code = nil
                                stack_trace = nil
                      Severity: Minor
                      Found in lib/fog/vcloud_director/core.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

                      Severity
                      Category
                      Status
                      Source
                      Language