Showing 460 of 460 total issues
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
module Compute
class VcloudDirector
class Real
extend Fog::Deprecation
deprecate :get_vm_cpu, :get_cpu_rasd_item
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 102.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
module Compute
class VcloudDirector
class Real
extend Fog::Deprecation
deprecate :get_vm_memory, :get_memory_rasd_item
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 102.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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"
Further reading
Similar blocks of code found in 2 locations. Consider refactoring. Open
module Compute
class VcloudDirector
class Real
# Delete an OrgVdcNetwork
#
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 94.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
module Compute
class VcloudDirector
class Real
# Delete a disk.
#
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 94.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method put_network_connection_system_section_vapp
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
def put_network_connection_system_section_vapp(id, options={})
options = options.dup
# Mutate options to new format.
deprecated = {