Showing 460 of 460 total issues

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

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

                module Compute
                  class VcloudDirector
                    class Real
                      extend Fog::Deprecation
                      deprecate :get_vm_cpu, :get_cpu_rasd_item
              lib/fog/vcloud_director/requests/compute/get_memory_rasd_item.rb on lines 2..56

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

              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
                      extend Fog::Deprecation
                      deprecate :get_vm_memory, :get_memory_rasd_item
              lib/fog/vcloud_director/requests/compute/get_cpu_rasd_item.rb on lines 2..57

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

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

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

                      module Compute
                        class VcloudDirector
                          class Real
                            # Delete an OrgVdcNetwork
                            #
                    Severity: Major
                    Found in lib/fog/vcloud_director/requests/compute/delete_network.rb and 1 other location - About 2 hrs to fix
                    lib/fog/vcloud_director/requests/compute/delete_disk.rb on lines 2..55

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

                    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
                            # Delete a disk.
                            #
                    Severity: Major
                    Found in lib/fog/vcloud_director/requests/compute/delete_disk.rb and 1 other location - About 2 hrs to fix
                    lib/fog/vcloud_director/requests/compute/delete_network.rb on lines 2..57

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

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

                            def put_network_connection_system_section_vapp(id, options={})
                              options = options.dup
                    
                              # Mutate options to new format.
                              deprecated = {
                      Severity
                      Category
                      Status
                      Source
                      Language