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
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
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)
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]
- 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 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
- 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
Class Server
has 42 methods (exceeds 20 allowed). Consider refactoring. Open
class Server < Fog::Ecloud::Model
extend Forwardable
identity :href
Class MockData
has 39 methods (exceeds 20 allowed). Consider refactoring. Open
class MockData < Base
def versions
@versions ||= []
end
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]
- 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 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
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
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]
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
- 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 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]
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 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]
- 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 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] ||= []
- 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 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|
- 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"