Showing 460 of 460 total issues

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

    Method instantiate_vapp_template has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def instantiate_vapp_template(vapp_name, template_id, options={})
              unless data[:catalog_items].values.find {|i| i[:template_id] == template_id}
                raise Fog::Compute::VcloudDirector::Forbidden.new(
                  'No such template.'
                )
    Severity: Major
    Found in lib/fog/vcloud_director/requests/compute/instantiate_vapp_template.rb - About 2 hrs to fix

      Method post_capture_vapp has a Cognitive Complexity of 18 (exceeds 5 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 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

      Method get_organization has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def get_organization(id)
                unless id == data[:org][:uuid]
                  raise Fog::Compute::VcloudDirector::Forbidden.new(
                    "No access to entity \"com.vmware.vcloud.entity.org:#{id}\""
                  )
      Severity: Major
      Found in lib/fog/vcloud_director/requests/compute/get_organization.rb - About 2 hrs to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          module Compute
            class VcloudDirector
              class Real
                # Retrieve the owner of a disk.
                #
        Severity: Major
        Found in lib/fog/vcloud_director/requests/compute/get_disk_owner.rb and 1 other location - About 2 hrs to fix
        lib/fog/vcloud_director/requests/compute/get_media_owner.rb on lines 2..65

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 89.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          module Compute
            class VcloudDirector
              class Real
                # Retrieve the owner of a media object.
                #
        Severity: Major
        Found in lib/fog/vcloud_director/requests/compute/get_media_owner.rb and 1 other location - About 2 hrs to fix
        lib/fog/vcloud_director/requests/compute/get_disk_owner.rb on lines 2..65

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 89.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Method template_pool has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def template_pool(filter = { })
        
                  templates = ::OpenNebula::TemplatePool.new(client)
                  if filter[:id].nil?
                    templates.info!(-2,-1,-1)
        Severity: Major
        Found in lib/fog/opennebula/requests/compute/template_pool.rb - About 2 hrs to fix

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

            module Compute
              class VcloudDirector
                class Real
                  # Merge the metadata provided in the request with existing metadata.
                  #
          lib/fog/vcloud_director/requests/compute/post_update_catalog_item_metadata.rb on lines 2..47
          lib/fog/vcloud_director/requests/compute/post_update_media_metadata.rb on lines 2..47
          lib/fog/vcloud_director/requests/compute/post_update_vapp_template_metadata.rb on lines 2..47

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 86.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

            module Compute
              class VcloudDirector
                class Real
                  # Merge the metadata provided in the request with existing metadata.
                  #
          lib/fog/vcloud_director/requests/compute/post_update_catalog_item_metadata.rb on lines 2..47
          lib/fog/vcloud_director/requests/compute/post_update_disk_metadata.rb on lines 2..47
          lib/fog/vcloud_director/requests/compute/post_update_media_metadata.rb on lines 2..47

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 86.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

            module Compute
              class VcloudDirector
                class Real
                  # Merge the metadata provided in the request with existing metadata.
                  #
          lib/fog/vcloud_director/requests/compute/post_update_catalog_item_metadata.rb on lines 2..47
          lib/fog/vcloud_director/requests/compute/post_update_disk_metadata.rb on lines 2..47
          lib/fog/vcloud_director/requests/compute/post_update_vapp_template_metadata.rb on lines 2..47

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 86.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

            module Compute
              class VcloudDirector
                class Real
                  # Merge the metadata provided in the request with existing catalog item metadata.
                  #
          lib/fog/vcloud_director/requests/compute/post_update_disk_metadata.rb on lines 2..47
          lib/fog/vcloud_director/requests/compute/post_update_media_metadata.rb on lines 2..47
          lib/fog/vcloud_director/requests/compute/post_update_vapp_template_metadata.rb on lines 2..47

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 86.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Method create_server has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def create_server(image_id, options = {})
                    raise Excon::Errors::BadRequest.new("Invalid image ID") unless image_id > 0
          
                    response = Excon::Response.new
                    response.status = 202
          Severity: Major
          Found in lib/fog/clodo/requests/compute/create_server.rb - About 2 hrs to fix

            Method save has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def save
                      unless persisted?
                        #Lame ...
                        raise RuntimeError, "Should not be here"
                      else
            Severity: Major
            Found in lib/fog/vcloud/models/compute/server.rb - About 2 hrs to fix

              Method [] has 57 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def self.[](service)
                      @@connections ||= Hash.new do |hash, key|
                        hash[key] = case key
                                    when :auto_scaling
                                      Fog::AWS::AutoScaling.new
              Severity: Major
              Found in lib/fog/aws/service_mapper.rb - About 2 hrs to fix

                Method post_upload_disk has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

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

                Method former_mvp? has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def former_mvp?(committer)
                         [
                           'Aaron Suggs',
                           'Akira Matsuda',
                           'ller', #"Achim Ledermüller" UTF-8 fail?
                Severity: Major
                Found in lib/tasks/changelog_task.rb - About 2 hrs to fix

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  module Fog
                    module Compute
                      class VcloudDirector
                        class VappTemplates < Collection
                  
                  
                  Severity: Major
                  Found in lib/fog/vcloud_director/models/compute/vapp_templates.rb and 1 other location - About 2 hrs to fix
                  lib/fog/vcloud_director/models/compute/vapps.rb on lines 4..35

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 83.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  module Fog
                    module Compute
                      class VcloudDirector
                        class Vapps < Collection
                  
                  
                  Severity: Major
                  Found in lib/fog/vcloud_director/models/compute/vapps.rb and 1 other location - About 2 hrs to fix
                  lib/fog/vcloud_director/models/compute/vapp_templates.rb on lines 4..35

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 83.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

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

                    Method build_source_items has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                              def build_source_items(xml)
                                vms = @configuration[:source_vms]
                                vms.each do |vm|
                                  xml.SourcedItem {
                                    xml.Source(:name =>vm[:name], :href => vm[:href])
                    Severity: Major
                    Found in lib/fog/vcloud_director/generators/compute/compose_common.rb - About 2 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language