fog/fog-ecloud

View on GitHub

Showing 165 of 165 total issues

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

        def node_service_create(service_data)
          validate_node_service_data(service_data)

          internet_service_id = service_data[:uri].match(/(\d+)/)[1]
          internet_service    = self.data[:internet_services][internet_service_id.to_i].dup
Severity: Minor
Found in lib/fog/compute/ecloud/requests/node_service_create.rb - About 1 hr to fix

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

            def get_servers(uri)
              if uri =~ /layoutgroups/i
                group_id        = id_from_uri(uri)
                group           = self.data[:groups][group_id]
                servers         = group[:VirtualMachines][:VirtualMachine]
    Severity: Minor
    Found in lib/fog/compute/ecloud/requests/get_servers.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 virtual_machine_edit_assigned_ips has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def virtual_machine_edit_assigned_ips(href, options)
              server_id       = href.match(/(\d+)/)[1].to_i
              server          = self.data[:servers][server_id]
              options.each do |network|
                network_id     = id_from_uri(network[:href])

      Method ssh_key_create has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def ssh_key_create(data)
                validate_data([:Name], data)
                ssh_key_id          = Fog::Mock.random_numbers(7).to_i
                ssh_key_fingerprint = ""
                (1..15).each do
      Severity: Minor
      Found in lib/fog/compute/ecloud/requests/ssh_key_create.rb - About 1 hr to fix

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

        module Fog
          module Compute
            class Ecloud
              class TrustedNetworkGroups < Fog::Ecloud::Collection
                identity :href
        Severity: Major
        Found in lib/fog/compute/ecloud/models/trusted_network_groups.rb and 1 other location - About 1 hr to fix
        lib/fog/compute/ecloud/models/firewall_acls.rb on lines 3..24

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

        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 Ecloud
              class FirewallAcls < Fog::Ecloud::Collection
                identity :href
        Severity: Major
        Found in lib/fog/compute/ecloud/models/firewall_acls.rb and 1 other location - About 1 hr to fix
        lib/fog/compute/ecloud/models/trusted_network_groups.rb on lines 3..24

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

        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

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

                    :HardwareConfiguration => {
                      :href => "/cloudapi/ecloud/virtualmachines/#{server_id}/hardwareconfiguration",
                      :type => "application/vnd.tmrk.cloud.virtualMachineHardware",
                      :Links => {
                        :Link => {
        lib/fog/compute/ecloud/requests/virtual_machine_import.rb on lines 92..119

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

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

                def request(params)
                  # Convert the uri to a URI if it's a string.
                  if params[:uri].is_a?(String)
                    params[:uri] = URI.parse(@host + params[:uri])
                  end
        Severity: Minor
        Found in lib/fog/compute/ecloud.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 generate_internet_service_request has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

                def generate_internet_service_request(service_data)
                  xml = Builder::XmlMarkup.new
                  xml.CreateInternetService(:name => service_data[:name]) do
                    xml.Protocol service_data[:protocol]
                    xml.Port service_data[:port]
        Severity: Minor
        Found in lib/fog/compute/ecloud/requests/internet_service_create.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

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

                    :HardwareConfiguration => {
                      :href => "/cloudapi/ecloud/virtualmachines/#{server_id}/hardwareconfiguration",
                      :type => "application/vnd.tmrk.cloud.virtualMachineHardware",
                      :Links => {
                        :Link => {
        Severity: Major
        Found in lib/fog/compute/ecloud/requests/virtual_machine_import.rb and 1 other location - About 1 hr to fix
        lib/fog/compute/ecloud/requests/virtual_machine_create_from_template.rb on lines 150..177

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

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

                def get_templates(uri) # /cloudapi/ecloud/computepools/compute_pools/534
                  compute_pool_id = id_from_uri(uri)
                  compute_pool    = self.data[:compute_pools][compute_pool_id]
        
                  templates = self.data[:templates].values.select{|template| template[:compute_pool_id] == compute_pool_id}
        Severity: Minor
        Found in lib/fog/compute/ecloud/requests/get_templates.rb - About 1 hr to fix

          Method request has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def request(params)
                    # Convert the uri to a URI if it's a string.
                    if params[:uri].is_a?(String)
                      params[:uri] = URI.parse(@host + params[:uri])
                    end
          Severity: Minor
          Found in lib/fog/compute/ecloud.rb - About 1 hr to fix

            Method virtual_machine_delete has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def virtual_machine_delete(uri)
                      server_id = id_from_uri(uri)
            
                      server = self.data[:servers][server_id]
                      self.data[:servers].delete(server_id)
            Severity: Minor
            Found in lib/fog/compute/ecloud/requests/virtual_machine_delete.rb - About 1 hr to fix

              Method virtual_machine_detach_disk has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def virtual_machine_detach_disk(href, options)
                        server_id        = href.match(/(\d+)/)[1].to_i
                        server           = self.data[:servers][server_id]
                        compute_pool_id  = server[:compute_pool_id]
                        compute_pool     = self.data[:compute_pools][compute_pool_id]
              Severity: Minor
              Found in lib/fog/compute/ecloud/requests/virtual_machine_detach_disk.rb - About 1 hr to fix

                Method build_request_body_edit_hardware_configuration has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        def build_request_body_edit_hardware_configuration(data)
                          xml = Builder::XmlMarkup.new
                          xml.HardwareConfiguration do
                            xml.ProcessorCount data[:cpus]
                            xml.Memory do

                  Method build_request_body_import has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          def build_request_body_import(options)
                            xml = Builder::XmlMarkup.new
                            xml.ImportVirtualMachine(:name => options[:name]) do
                              xml.ProcessorCount options[:cpus]
                              xml.Memory do
                  Severity: Minor
                  Found in lib/fog/compute/ecloud/requests/virtual_machine_import.rb - About 1 hr to fix

                    Method set_extra_headers_for has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            def set_extra_headers_for(params)
                              length_required = ["PUT", "POST", "DELETE"]
                              params[:headers] = {
                                "x-tmrk-version" => @version,
                                "Date"           => Time.now.utc.strftime("%a, %d %b %Y %H:%M:%S GMT"),
                    Severity: Minor
                    Found in lib/fog/compute/ecloud.rb - About 1 hr to fix

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

                      module Fog
                        module Compute
                          class Ecloud
                            class Rnats < Fog::Ecloud::Collection
                              identity :href
                      Severity: Major
                      Found in lib/fog/compute/ecloud/models/rnats.rb and 3 other locations - About 1 hr to fix
                      lib/fog/compute/ecloud/models/cpu_usage_detail_summary.rb on lines 3..23
                      lib/fog/compute/ecloud/models/memory_usage_detail_summary.rb on lines 3..23
                      lib/fog/compute/ecloud/models/storage_usage_detail_summary.rb on lines 3..23

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

                      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 Fog
                        module Compute
                          class Ecloud
                            class MemoryUsageDetailSummary < Fog::Ecloud::Collection
                              identity :href
                      lib/fog/compute/ecloud/models/cpu_usage_detail_summary.rb on lines 3..23
                      lib/fog/compute/ecloud/models/rnats.rb on lines 3..23
                      lib/fog/compute/ecloud/models/storage_usage_detail_summary.rb on lines 3..23

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

                      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 Fog
                        module Compute
                          class Ecloud
                            class StorageUsageDetailSummary < Fog::Ecloud::Collection
                              identity :href
                      lib/fog/compute/ecloud/models/cpu_usage_detail_summary.rb on lines 3..23
                      lib/fog/compute/ecloud/models/memory_usage_detail_summary.rb on lines 3..23
                      lib/fog/compute/ecloud/models/rnats.rb on lines 3..23

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

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language