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
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
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"),
- Read upRead up
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
- Read upRead up
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
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"),
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
- Read upRead up
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 = "")