fog/fog-ecloud

View on GitHub
lib/fog/compute/ecloud.rb

Summary

Maintainability
F
4 days
Test Coverage

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

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

          Method initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                  def initialize(options = {})
                    @base_path               = options[:base_path] || "/cloudapi/ecloud"
                    @connections             = {}
                    @connection_options      = options[:connection_options] || {}
                    @host                    = options[:ecloud_host] || API_URL
          Severity: Minor
          Found in lib/fog/compute/ecloud.rb - About 45 mins 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 basic_request has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                    def basic_request(name, expects = [200], method = :get, headers = {}, body = "")
          Severity: Minor
          Found in lib/fog/compute/ecloud.rb - About 35 mins to fix

            There are no issues that match your filters.

            Category
            Status