Showing 248 of 459 total issues

Method get_vdc has 124 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def get_vdc(vdc_id)
          response = Excon::Response.new

          unless vdc = data[:vdcs][vdc_id]
            raise Fog::Compute::VcloudDirector::Forbidden.new(
Severity: Major
Found in lib/fog/vcloud_director/requests/compute/get_vdc.rb - About 4 hrs to fix

    Method put_network_connection_system_section_vapp has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
    Open

            def put_network_connection_system_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 save has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

            def save
              unless persisted?
                #Lame ...
                raise RuntimeError, "Should not be here"
              else
    Severity: Minor
    Found in lib/fog/vcloud/models/compute/server.rb - About 4 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

    File compute.rb has 311 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'fog/vcloud/core'
    
    module Fog
      module Vcloud
        class Collection < Fog::Collection
    Severity: Minor
    Found in lib/fog/vcloud/compute.rb - About 3 hrs to fix

      Method list_networks has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

              def list_networks(filter = { })
                networks=[]
                netpool = ::OpenNebula::VirtualNetworkPool.new(client)
                if filter[:id].nil?
                  netpool.info!(-2,-1,-1)
      Severity: Minor
      Found in lib/fog/opennebula/requests/compute/list_networks.rb - About 3 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 28 methods (exceeds 20 allowed). Consider refactoring.
      Open

            class Server < Fog::Compute::Server
              identity  :ctid
              attribute :ostemplate
              attribute :config
              attribute :layout
      Severity: Minor
      Found in lib/fog/openvz/models/compute/server.rb - About 3 hrs to fix

        Method mount_volume has a Cognitive Complexity of 23 (exceeds 5 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 3 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 post_create_org_vdc_network has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

                def post_create_org_vdc_network(vdc_id, name, options={})
                  unless data[:vdcs][vdc_id]
                    raise Fog::Compute::VcloudDirector::Forbidden.new(
                      "No access to entity \"(com.vmware.vcloud.entity.vdc:#{vdc_id})\"."
                    )

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

                def put_network(id, name, options={})
                  original_network = data[:networks][id]
                  unless original_network
                    raise Fog::Compute::VcloudDirector::Forbidden.new(
                      "No access to entity \"(com.vmware.vcloud.entity.orgVdcNetwork:#{id})\"."
        Severity: Minor
        Found in lib/fog/vcloud_director/requests/compute/put_network.rb - About 3 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 post_instantiate_vapp_template has 75 lines of code (exceeds 25 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',

          Method put_guest_customization_section_vapp has 75 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            Method populate_locations has 74 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def self.populate_locations
                      locations = {}
                      locations["41"] = {
                        "state"=>1,
                        "location"=>"RTP",
            Severity: Major
            Found in lib/fog/ibm/compute.rb - About 2 hrs to fix

              Method build_nat_service has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

                        def build_nat_service(xml)
                          nat_config = @configuration[:NatService]
                          return unless nat_config
              
                          xml.NatService {

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

              require 'fog/vcloud/models/compute/helpers/status'
              module Fog
                module Vcloud
                  class Compute
                    class Server < Fog::Vcloud::Model
              Severity: Minor
              Found in lib/fog/vcloud/models/compute/server.rb - About 2 hrs to fix

                Class ChangelogTask has 25 methods (exceeds 20 allowed). Consider refactoring.
                Open

                    class ChangelogTask < ::Rake::TaskLib
                      def initialize
                        desc "Update the changelog since the last release"
                        task(:changelog) do
                
                
                Severity: Minor
                Found in lib/tasks/changelog_task.rb - About 2 hrs to fix

                  Method post_create_org_vdc_network has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          def post_create_org_vdc_network(vdc_id, name, options={})
                            unless data[:vdcs][vdc_id]
                              raise Fog::Compute::VcloudDirector::Forbidden.new(
                                "No access to entity \"(com.vmware.vcloud.entity.vdc:#{vdc_id})\"."
                              )

                    Method build_load_balancer_service has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                              def build_load_balancer_service(xml)
                                lb_config = @configuration[:LoadBalancerService]
                                return unless lb_config
                    
                                xml.LoadBalancerService {

                      Method generate_xml has 65 lines of code (exceeds 25 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: Major
                      Found in lib/fog/vcloud_director/generators/compute/org_vdc_network.rb - About 2 hrs to fix

                        Method save has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                        Open

                                def save
                                  self.ttl ||= 1800
                                  requires :name, :type, :value, :ttl
                                  options = {}
                                  options[:ttl]  = ttl if ttl
                        Severity: Minor
                        Found in lib/fog/dnsmadeeasy/models/dns/record.rb - About 2 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

                        Severity
                        Category
                        Status
                        Source
                        Language