Showing 41 of 140 total issues
Method data
has 1040 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.data
dc1_id = Fog::UUID.uuid
dc2_id = Fog::UUID.uuid
serv1_id = Fog::UUID.uuid
vol1_id = Fog::UUID.uuid
File compute.rb
has 1246 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Fog
module Compute
class ProfitBricks < Fog::Service
API_VERSION = 'v4'.freeze
Method create_server
has 123 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_server(datacenter_id, properties = {}, entities = {})
if properties[:cores] == nil
raise Excon::Error::HTTPStatus, "Attribute 'cores' is required"
end
Method create_datacenter
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_datacenter(options, entities={})
dc = {
:properties => options,
:entities => entities
}
Method get_firewall_rules
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def get_firewall_rules(firewall_rules)
items = []
for firewall_rule in firewall_rules do
item = {}
item[:name] = firewall_rule[:name] if firewall_rule.key?(:name)
- 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 get_firewall_rules
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def get_firewall_rules(firewall_rules)
items = []
firewall_rules.each do |firewall_rule|
item = {}
item[:name] = firewall_rule[:name] if firewall_rule.key?(:name)
- 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 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Server < Fog::Models::ProfitBricks::Base
include Fog::Helpers::ProfitBricks::DataHelper
identity :id
Method get_all_flavors
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_all_flavors
response = Excon::Response.new
response.status = 200
response.body = {
'getAllFlavorsResponse' => [
Method get_flavor
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_flavor(flavor_id)
response = Excon::Response.new
response.status = 200
response.body = {
"getFlavorResponse" => [
Method create_volume
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_volume(datacenter_id, options = {})
response = Excon::Response.new
response.status = 202
if options[:size] == nil
Method create_volume_snapshot
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_volume_snapshot(datacenter_id, _volume_id, options = {})
response = Excon::Response.new
response.status = 202
if datacenter = data[:datacenters]['items'].find do |attrib|
Method create_user
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_user(options = {})
if options[:email] == nil
raise Excon::Error::HTTPStatus, "Attribute 'email' is required"
end
Method get_nics
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def get_nics(nics)
items = []
for nic in nics do
firewall_rules = nil
item = {}
- 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 update
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def update
requires :id
options = {}
options[:name] = name if name
- 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 update
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def update
requires :id
options = {}
options[:name] = name if name
- 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_lan
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_lan(datacenter_id, properties = {}, _entities = {})
response = Excon::Response.new
response.status = 202
if datacenter = data[:datacenters]['items'].find do |attrib|
Method create_group
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_group(options = {})
if options[:name] == nil
raise Excon::Error::HTTPStatus, "Attribute 'name' is required"
end
Method attach_volume
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def attach_volume(datacenter_id, server_id, storage_id)
if volume = data[:volumes]['items'].find do |vlm|
vlm["id"] == storage_id && vlm["datacenter_id"] == datacenter_id
end
else
Method create_firewall_rule
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_firewall_rule(datacenter_id, server_id, nic_id, options = {})
response = Excon::Response.new
response.status = 202
properties = {}
Method attach_cdrom
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def attach_cdrom(datacenter_id, server_id, cdrom_image_id)
if cdrom = data[:images]['items'].find do |cd|
cd["id"] == cdrom_image_id
end
else