Showing 248 of 460 total issues
Method get_vdc
has 124 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_vdc(vdc_id)
response = Excon::Response.new
unless vdc = data[:vdcs][vdc_id]
raise Fog::Compute::VcloudDirector::Forbidden.new(
Method put_network_connection_system_section_vapp
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def put_network_connection_system_section_vapp(id, options={})
options = options.dup
# Mutate options to new format.
deprecated = {
- 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 save
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def save
unless persisted?
#Lame ...
raise RuntimeError, "Should not be here"
else
- 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
File compute.rb
has 311 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'fog/vcloud/core'
module Fog
module Vcloud
class Collection < Fog::Collection
Method list_networks
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def list_networks(filter = { })
networks=[]
netpool = ::OpenNebula::VirtualNetworkPool.new(client)
if filter[:id].nil?
netpool.info!(-2,-1,-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
Class Server
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Server < Fog::Compute::Server
identity :ctid
attribute :ostemplate
attribute :config
attribute :layout
Method mount_volume
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def mount_volume(volume, device = 'virtio', dev_channel = nil, boot_order = nil)
unless dev_channel
specified_channels = self.volumes.map { |v| v.dev_channel }.sort
if specified_channels
controller, controller_channel = 0, 0
- 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 post_create_org_vdc_network
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def post_create_org_vdc_network(vdc_id, name, options={})
unless data[:vdcs][vdc_id]
raise Fog::Compute::VcloudDirector::Forbidden.new(
"No access to entity \"(com.vmware.vcloud.entity.vdc:#{vdc_id})\"."
)
- 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_execute_query
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def get_execute_query(type=nil, options={})
if type.nil?
response = request(
:expects => 200,
:idempotent => true,
- 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 put_network
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def put_network(id, name, options={})
original_network = data[:networks][id]
unless original_network
raise Fog::Compute::VcloudDirector::Forbidden.new(
"No access to entity \"(com.vmware.vcloud.entity.orgVdcNetwork:#{id})\"."
- 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 post_instantiate_vapp_template
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
def post_instantiate_vapp_template(id, vapp_template_id, name, options={})
body = Nokogiri::XML::Builder.new do
attrs = {
'xmlns' => 'http://www.vmware.com/vcloud/v1.5',
'xmlns:ovf' => 'http://schemas.dmtf.org/ovf/envelope/1',
Method put_guest_customization_section_vapp
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
def put_guest_customization_section_vapp(id, options={})
options = options.dup
# Mutate options to new format.
deprecated = {
Method populate_locations
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.populate_locations
locations = {}
locations["41"] = {
"state"=>1,
"location"=>"RTP",
Method build_nat_service
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def build_nat_service(xml)
nat_config = @configuration[:NatService]
return unless nat_config
xml.NatService {
- 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
File server.rb
has 287 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'fog/vcloud/models/compute/helpers/status'
module Fog
module Vcloud
class Compute
class Server < Fog::Vcloud::Model
Class ChangelogTask
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class ChangelogTask < ::Rake::TaskLib
def initialize
desc "Update the changelog since the last release"
task(:changelog) do
Method post_create_org_vdc_network
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
def post_create_org_vdc_network(vdc_id, name, options={})
unless data[:vdcs][vdc_id]
raise Fog::Compute::VcloudDirector::Forbidden.new(
"No access to entity \"(com.vmware.vcloud.entity.vdc:#{vdc_id})\"."
)
Method build_load_balancer_service
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_load_balancer_service(xml)
lb_config = @configuration[:LoadBalancerService]
return unless lb_config
xml.LoadBalancerService {
Method generate_xml
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate_xml
body = Nokogiri::XML::Builder.new do
attrs = {
:xmlns => 'http://www.vmware.com/vcloud/v1.5',
:name => options[:name]
Method save
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def save
self.ttl ||= 1800
requires :name, :type, :value, :ttl
options = {}
options[:ttl] = ttl if ttl
- 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"