fog/fog-ecloud

View on GitHub

Showing 165 of 165 total issues

File ecloud.rb has 789 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require File.expand_path("../ecloud/models/model", __FILE__)
require File.expand_path("../ecloud/models/collection", __FILE__)
require File.expand_path("../ecloud/errors", __FILE__)

module Fog
Severity: Major
Found in lib/fog/compute/ecloud.rb - About 1 day to fix

    Method data has 354 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def self.data
              @data ||= Hash.new do |hash, key|
                hash[key] = begin
                              compute_pool_id            = Fog.credentials[:ecloud_compute_pool_id]  || Fog::Mock.random_numbers(3).to_i
                              environment_id             = Fog.credentials[:ecloud_environment_id]   || Fog::Mock.random_numbers(3).to_i
    Severity: Major
    Found in lib/fog/compute/ecloud.rb - About 1 day to fix

      File mock_data_classes.rb has 590 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module Fog
        module Ecloud
          module MockDataClasses
            class Base < Hash
              def self.base_url=(url)
      Severity: Major
      Found in lib/fog/ecloud/mock_data_classes.rb - About 1 day to fix

        Method build_request_body_copy has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
        Open

                def build_request_body_copy(options)
                  xml = Builder::XmlMarkup.new
                  xml.CopyVirtualMachine(:name => options[:name]) do
                    xml.Source(:href => options[:source], :type => "application/vnd.tmrk.cloud.virtualMachine")
                    xml.ProcessorCount options[:cpus]
        Severity: Minor
        Found in lib/fog/compute/ecloud/requests/virtual_machine_copy.rb - About 5 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 build_request_body has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
        Open

                def build_request_body(options)
                  xml = Builder::XmlMarkup.new
                  xml.CreateVirtualMachine(:name => options[:name]) do
                    xml.ProcessorCount options[:cpus]
                    xml.Memory do

        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 42 methods (exceeds 20 allowed). Consider refactoring.
        Open

              class Server < Fog::Ecloud::Model
                extend Forwardable
        
                identity :href
        
        
        Severity: Minor
        Found in lib/fog/compute/ecloud/models/server.rb - About 5 hrs to fix

          Class MockData has 39 methods (exceeds 20 allowed). Consider refactoring.
          Open

                class MockData < Base
                  def versions
                    @versions ||= []
                  end
          
          
          Severity: Minor
          Found in lib/fog/ecloud/mock_data_classes.rb - About 5 hrs to fix

            Method virtual_machine_create_from_template has 114 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def virtual_machine_create_from_template(template_uri, options)
                      options                      = validate_create_server_options(template_uri, options)
                      server_id                    = Fog::Mock.random_numbers(7).to_i
                      row_id                       = Fog::Mock.random_numbers(6).to_i
                      group_id                     = Fog::Mock.random_numbers(6).to_i

              Method generate_create_firewall_acls_request has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
              Open

                      def generate_create_firewall_acls_request(data)
                        xml = Builder::XmlMarkup.new
                        xml.CreateFirewallAcl do
                          xml.Permission data[:permission]
                          xml.Protocol data[:protocol]
              Severity: Minor
              Found in lib/fog/compute/ecloud/requests/firewall_acls_create.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

              Method virtual_machine_import has 101 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def virtual_machine_import(template_uri, options)
                        options         = validate_import_server_options(template_uri, options)
              
                        compute_pool_id = options[:uri].match(/computePools\/(\d+)/)[1].to_i
                        compute_pool    = self.data[:compute_pools][compute_pool_id].dup
              Severity: Major
              Found in lib/fog/compute/ecloud/requests/virtual_machine_import.rb - About 4 hrs to fix

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

                  module Compute
                    class Ecloud
                      class Real
                        include Shared
                
                
                lib/fog/compute/ecloud/requests/backup_internet_service_create.rb on lines 2..40

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

                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 Ecloud
                      class Real
                        include Shared
                
                
                lib/fog/compute/ecloud/requests/backup_internet_service_edit.rb on lines 2..40

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

                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 Ecloud
                      class Real
                        include Shared
                
                
                lib/fog/compute/ecloud/requests/trusted_network_groups_edit.rb on lines 2..41

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

                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 Ecloud
                      class Real
                        include Shared
                
                
                lib/fog/compute/ecloud/requests/trusted_network_groups_create.rb on lines 2..41

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

                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

                File server.rb has 285 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                module Fog
                  module Compute
                    class Ecloud
                      class Server < Fog::Ecloud::Model
                        extend Forwardable
                Severity: Minor
                Found in lib/fog/compute/ecloud/models/server.rb - About 2 hrs to fix

                  Method build_request_body_copy has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          def build_request_body_copy(options)
                            xml = Builder::XmlMarkup.new
                            xml.CopyVirtualMachine(:name => options[:name]) do
                              xml.Source(:href => options[:source], :type => "application/vnd.tmrk.cloud.virtualMachine")
                              xml.ProcessorCount options[:cpus]
                  Severity: Major
                  Found in lib/fog/compute/ecloud/requests/virtual_machine_copy.rb - About 2 hrs to fix

                    Method build_request_body has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            def build_request_body(options)
                              xml = Builder::XmlMarkup.new
                              xml.CreateVirtualMachine(:name => options[:name]) do
                                xml.ProcessorCount options[:cpus]
                                xml.Memory do

                      Method copy has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def copy(options = {})
                                options = { :type => :copy }.merge(options)
                                options[:source] ||= href
                                if options[:type] == :copy
                                  options[:cpus] ||= 1
                      Severity: Minor
                      Found in lib/fog/compute/ecloud/models/server.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 Ecloud
                            class Real
                              include Shared
                      
                      
                      Severity: Major
                      Found in lib/fog/compute/ecloud/requests/monitors_edit_http.rb and 1 other location - About 2 hrs to fix
                      lib/fog/compute/ecloud/requests/monitors_create_http.rb on lines 2..36

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

                      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 Ecloud
                            class Real
                              include Shared
                      
                      
                      Severity: Major
                      Found in lib/fog/compute/ecloud/requests/monitors_create_http.rb and 1 other location - About 2 hrs to fix
                      lib/fog/compute/ecloud/requests/monitors_edit_http.rb on lines 2..36

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

                      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