Showing 460 of 460 total issues
Method get_supported_versions
has 1129 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_supported_versions
body =
{:xmlns=>"http://www.vmware.com/vcloud/versions",
:xmlns_xsi=>xmlns_xsi,
:xsi_schemaLocation=>xsi_schema_location,
File get_supported_versions.rb
has 1150 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Fog
module Compute
class VcloudDirector
class Real
# List all supported versions.
Method build_source_items
has a Cognitive Complexity of 144 (exceeds 5 allowed). Consider refactoring. Open
def build_source_items(xml)
vms = @configuration[:source_vms]
vms.each do |vm|
xml.SourcedItem {
xml.Source(:name =>vm[:name], :href => vm[:href])
- 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_xml
has a Cognitive Complexity of 140 (exceeds 5 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]
- 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_xml
has a Cognitive Complexity of 108 (exceeds 5 allowed). Consider refactoring. Open
def generate_xml
body = Nokogiri::XML::Builder.new do |xml|
attrs = {
:xmlns => 'http://www.vmware.com/vcloud/v1.5',
'xmlns:ovf' => 'http://schemas.dmtf.org/ovf/envelope/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
File compute.rb
has 801 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'fog/vcloud_director/core'
require 'fog/vcloud_director/query'
class VcloudDirectorParser < Fog::Parsers::Base
def extract_attributes(attributes_xml)
Method all_types
has 328 lines of code (exceeds 25 allowed). Consider refactoring. Open
def all_types
{:xmlns=>xmlns,
:xmlns_xsi=>xmlns_xsi,
:type=>"application/vnd.vmware.vcloud.query.queryList+xml",
:href=>make_href('query'),
Method post_instantiate_vapp_template
has a Cognitive Complexity of 82 (exceeds 5 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',
- 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 get_execute_query.rb
has 630 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Fog
module Compute
class VcloudDirector
class Real
# REST API General queries handler.
Method data
has 245 lines of code (exceeds 25 allowed). Consider refactoring. Open
def data
@@data ||= Hash.new do |hash, key|
vdc1_uuid = uuid
vdc2_uuid = uuid
Method generate_configure_vm_request
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
def generate_configure_vm_request(vm_data)
xmlns = 'http://schemas.dmtf.org/ovf/envelope/1'
xmlns_vcloud = 'http://www.vmware.com/vcloud/v1'
xmlns_rasd = 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData'
xmlns_vssd = 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData'
- 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 vm_allocate
has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring. Open
def vm_allocate(attr={ })
if(attr[:flavor].nil?)
raise(ArgumentError.new("Attribute flavor is nil! #{attr.inspect}"))
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 fetch_items
has 216 lines of code (exceeds 25 allowed). Consider refactoring. Open
def fetch_items(type, opts)
if opts.key?(:filter) && opts[:filter] =~ /^name==([^;,]+)$/
name = $1
elsif type == 'vAppTemplate' && opts.key?(:filter) &&
opts[:filter] =~ /^name==([^;,]+);catalogName==([^;,]+)$/ #TODO also match in other order
Method get_supported_systems_info
has 208 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_supported_systems_info
body = # this is a subset of the full list
{:xmlns=>xmlns,
:xmlns_xsi=>xmlns_xsi,
:type=>"application/vnd.vmware.vcloud.supportedSystemsInfo+xml",
Method build_firewall_service
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
def build_firewall_service(xml)
firewall_config = @configuration[:FirewallService]
return unless firewall_config
xml.FirewallService {
- 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_guest_customization_section_vapp
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
def put_guest_customization_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 fetch_items
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
def fetch_items(type, opts)
if opts.key?(:filter) && opts[:filter] =~ /^name==([^;,]+)$/
name = $1
elsif type == 'vAppTemplate' && opts.key?(:filter) &&
opts[:filter] =~ /^name==([^;,]+);catalogName==([^;,]+)$/ #TODO also match in other order
- 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 template_pool
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
def template_pool(filter = { })
templates = ::OpenNebula::TemplatePool.new(client)
if filter[:id].nil?
templates.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
Similar blocks of code found in 9 locations. Consider refactoring. Open
module Compute
class VcloudDirector
class Real
# Retrieves a media list by using REST API general QueryHandler.
#
- 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 200.
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 9 locations. Consider refactoring. Open
module Compute
class VcloudDirector
class Real
# Retrieves a list of organizations by using REST API general
# QueryHandler.
- 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 200.
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