Showing 248 of 460 total issues

Method virtual_hardware_section has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def virtual_hardware_section(xml, options)
          return unless options[:cpu] or options[:memory]
          xml['ovf'].VirtualHardwareSection do
            xml['ovf'].Info 'Virtual Hardware Requirements'
            cpu_section(xml, options[:cpu]) if options[:cpu]
Severity: Minor
Found in lib/fog/vcloud_director/requests/compute/post_reconfigure_vm.rb - About 35 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 get_context has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def get_context
          return "" unless context
          if context.is_a? String
            return %Q|CONTEXT= [ #{context} ]\n|
          elsif context.is_a? Hash
Severity: Minor
Found in lib/fog/opennebula/models/compute/flavor.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

        def save
          raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
          @data_center, @flavor, @image, @kernel, @type, @payment_terms, @stack_script, @name, @password, @callback =
            attributes.values_at :data_center, :flavor, :image, :kernel, :type, :payment_terms, :stack_script, :name, :password, :callback

Severity: Minor
Found in lib/fog/linode/models/compute/server.rb - About 35 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 request has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def request(params)
          params[:headers] = params.fetch(:headers, {}).merge(auth_header(@auth_type))
          params[:headers]['Content-Type'] = 'application/json; charset=utf-8'

          req_path = params[:path]
Severity: Minor
Found in lib/fog/cloudsigma/connection.rb - About 35 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 get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def get(identifier)
          return nil if identifier.nil? || identifier == ""

          begin
            details = service.server_details(identifier).body['response']
Severity: Minor
Found in lib/fog/glesys/models/compute/servers.rb - About 25 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 list_servers_detail has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def list_servers_detail
          response = Excon::Response.new

          servers = self.data[:servers].values
          for server in servers
Severity: Minor
Found in lib/fog/clodo/requests/compute/list_servers_detail.rb - About 25 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 public_ip_address has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def public_ip_address
          pubaddrs = addresses && addresses['public'] ? addresses['public'].select {|ip| ip['primary_ip']} : nil
          pubaddrs && !pubaddrs.empty? ? pubaddrs.first['ip'] : nil
        end
Severity: Minor
Found in lib/fog/clodo/models/compute/server.rb - About 25 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 request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def request(params)
          params[:query] ||= {}
          params[:query].merge!({
            :password => @bare_metal_cloud_password,
            :username => @bare_metal_cloud_username
Severity: Minor
Found in lib/fog/bare_metal_cloud/compute.rb - About 25 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 put_vm_capabilities has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def put_vm_capabilities(id, options={})
          body = Nokogiri::XML::Builder.new do
            attrs = {
              :xmlns => 'http://www.vmware.com/vcloud/v1.5'
            }
Severity: Minor
Found in lib/fog/vcloud_director/requests/compute/put_vm_capabilities.rb - About 25 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 generate_xml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def generate_xml
            attrs = @attrs
            Nokogiri::XML::Builder.new do
              Vm('xmlns' => 'http://www.vmware.com/vcloud/v1.5', 'name' => attrs[:name]) {
                Description attrs[:Description] if attrs.key?(:Description)
Severity: Minor
Found in lib/fog/vcloud_director/generators/compute/vm.rb - About 25 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 modify_key has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def modify_key(key_name, params={})
          response = Excon::Response.new
          if key_exists? key_name
            if params['public_key']
              self.data[:keys][key_name]['keyMaterial'] = public_key
Severity: Minor
Found in lib/fog/ibm/requests/compute/modify_key.rb - About 25 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 post_upload_media has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def post_upload_media(vdc_id, name, image_type, size, options={})
          unless ['iso','floppy'].include?(image_type)
            raise Fog::Compute::VcloudDirector::BadRequest.new(
              'The value of parameter imageType is incorrect.'
            )
Severity: Minor
Found in lib/fog/vcloud_director/requests/compute/post_upload_media.rb - About 25 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 post_clone_vapp_template has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def post_clone_vapp_template(vdc_id, name, source_id, options={})
          body = Nokogiri::XML::Builder.new do
            attrs = {
              :xmlns => 'http://www.vmware.com/vcloud/v1.5',
              :name => name
Severity: Minor
Found in lib/fog/vcloud_director/requests/compute/post_clone_vapp_template.rb - About 25 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 add_ip_address has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def add_ip_address(server_id)
          raise Excon::Errors::BadRequest.new(
                                              "Invalid image ID"
                                              ) unless server_id > 0

Severity: Minor
Found in lib/fog/clodo/requests/compute/add_ip_address.rb - About 25 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 authenticate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.authenticate(options)
      clodo_auth_url = options[:clodo_auth_url] || "api.clodo.ru"
      url = clodo_auth_url.match(/^https?:/) ? \
                clodo_auth_url : 'https://' + clodo_auth_url
      uri = URI.parse(url)
Severity: Minor
Found in lib/fog/clodo/core.rb - About 25 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 request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def request(params)
          params = {
            :expects  => 200,
            :method   => 'GET'
          }.merge!(params)
Severity: Minor
Found in lib/fog/go_grid/compute.rb - About 25 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 basic_request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def basic_request(*args)
            self.class_eval <<-EOS, __FILE__,__LINE__
              def #{args[0]}(uri)
                request(
                  {
Severity: Minor
Found in lib/fog/vcloud/compute.rb - About 25 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 post_attach_disk has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def post_attach_disk(id, disk_id, options={})
          body = Nokogiri::XML::Builder.new do
            attrs = {
              :xmlns => 'http://www.vmware.com/vcloud/v1.5'
            }
Severity: Minor
Found in lib/fog/vcloud_director/requests/compute/post_attach_disk.rb - About 25 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 end_element has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def end_element(name)
            case name
            when 'Enabled'
              @response[:enabled] = (value == "true")
            when 'ChangeSid'
Severity: Minor
Found in lib/fog/vcloud_director/parsers/compute/vm_customization.rb - About 25 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 post_deploy_vapp has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def post_deploy_vapp(id, options={})
          body = Nokogiri::XML::Builder.new do
            attrs = {
              :xmlns => 'http://www.vmware.com/vcloud/v1.5'
            }
Severity: Minor
Found in lib/fog/vcloud_director/requests/compute/post_deploy_vapp.rb - About 25 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