fog/fog-ecloud

View on GitHub

Showing 92 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

                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

                      Method generate_create_firewall_acls_request has 49 lines of code (exceeds 25 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 1 hr to fix

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

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

                                def build_password_complexity_rules_edit(data)
                                  xml = Builder::XmlMarkup.new
                                  xml.PasswordComplexityRules do
                                    xml.RuleType data[:rule_type]
                                    if data[:rule_type] == "Custom"

                          Method build_node_service_body_edit has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                                  def build_node_service_body_edit(options)
                                    xml = Builder::XmlMarkup.new
                                    xml.InternetService(:name => options[:name]) do
                                      xml.Enabled options[:enabled]
                                      if options[:description]
                          Severity: Minor
                          Found in lib/fog/compute/ecloud/requests/internet_service_edit.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 create has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                                  def create(template_uri, options)
                                    options[:cpus] ||= 1
                                    options[:memory] ||= 512
                                    options[:description] ||= ""
                                    options[:tags] ||= []
                          Severity: Minor
                          Found in lib/fog/compute/ecloud/models/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 all has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                                  def all
                                    r_data = []
                                    data = service.get_templates(href).body[:Families]
                                    data[:Family].is_a?(Hash) ? data = [data[:Family]] : data = data[:Family]
                                    data.each do |d|
                          Severity: Minor
                          Found in lib/fog/compute/ecloud/models/templates.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

                          Severity
                          Category
                          Status
                          Source
                          Language