Showing 248 of 460 total issues
Method request
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def request(method_name, options = {})
options.merge!( {:format => 'json'})
begin
parser = options.delete(:parser)
Method generate_configure_vm_disks_request
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate_configure_vm_disks_request(href, disk_data)
xmlns = {
"xmlns:rasd" => "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData",
"xmlns" => "http://www.vmware.com/vcloud/v1"
}
Method post_create_catalog_item
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def post_create_catalog_item(id, name, entity, options={})
body = Nokogiri::XML::Builder.new do
attrs = {
:xmlns => 'http://www.vmware.com/vcloud/v1.5',
:name => name,
Method get_execute_query
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_execute_query(type=nil, options={})
unless options[:fields].nil?
Fog::Mock.not_implemented("Fields are not yet implemented in get_execute_query Mock for #{type}")
end
Method put_memory
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def put_memory(id, memory)
data = <<EOF
<Item
xmlns="http://www.vmware.com/vcloud/v1.5"
xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"
Method post_update_vapp_metadata
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def post_update_vapp_metadata(id, metadata={})
unless vm = data[:vms][id]
raise Fog::Compute::VcloudDirector::Forbidden.new(
'This operation is denied.'
)
Method post_reconfigure_vm
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def post_reconfigure_vm(id, options={})
unless vm = data[:vms][id]
raise Fog::Compute::VcloudDirector::Forbidden.new(
'This operation is denied.'
)
Method put_cpu
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def put_cpu(id, num_cpus)
data = <<EOF
<Item
xmlns="http://www.vmware.com/vcloud/v1.5"
xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"
Method request
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def request(params)
begin
response = @connection.request(params.merge({
:headers => {
'Content-Type' => 'application/json',
- 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 check_href!
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def check_href!(opts = {})
self.href = service.default_vdc_href unless href
unless href
if opts.is_a?(String)
t = Hash.new
- 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 ensure_list!
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def ensure_list!(hash, key1, key2=nil)
if key2.nil?
hash[key1] ||= []
hash[key1] = [hash[key1]] if hash[key1].is_a?(Hash)
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
Method post_clone_vapp
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def post_clone_vapp(vdc_id, name, source_id, options={})
body = Nokogiri::XML::Builder.new do
attrs = {
:xmlns => 'http://www.vmware.com/vcloud/v1.5',
:name => 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 save
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def save
requires :domain, :type
requires :email if type == 'master'
options = {}
# * options<~Hash>
- 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_image_agreement
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_image_agreement(image_id)
response = Excon::Response.new
response.status = 200
response.body = {"text"=>
"test, operating system is SUSE Linux Enterprise Server/11 SP1 - English\n\nYour access to and use of the Service, including all selected options, are governed by the terms of the Agreement signed between your Enterprise and IBM. Each Service is also governed by one or more Attachments (including, for example, Image Terms Attachments). Applicable Attachments are part of the Agreement between you and IBM and include Attachments for Services you acquire after the Agreement was signed. The Agreement also references applicable IBM and third party end user license agreements that govern the use of IBM software and operating system software provided as part of an Image.\n\nYou are responsible for complying with the terms of the Agreement (including applicable Attachments) and applicable license agreements. You may review the terms for the Service by 1) obtaining information regarding the Agreement from your Account Administrator and 2) accessing the Asset Catalog to review specific Image Terms and end user license agreements for IBM and third party software provided as part of an Image. ",
Method put_media_metadata_item_metadata
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def put_media_metadata_item_metadata(id, key, value)
body = Nokogiri::XML::Builder.new do
attrs = {
:xmlns => 'http://www.vmware.com/vcloud/v1.5',
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance'
Method end_element
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def end_element(name)
case name
when 'Address'
@disk[:address] = value.to_i
when 'AddressOnParent'
Method get_network
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_network(id)
Fog::Logger.deprecation("#{self} => #get_network is deprecated, use #get_network_complete instead [light_black](#{caller.first})[/]")
unless network = data[:networks][id]
raise Fog::Compute::VcloudDirector::Forbidden.new(
'This operation is denied.'
Method put_vapp_template_metadata_item_metadata
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def put_vapp_template_metadata_item_metadata(id, key, value)
body = Nokogiri::XML::Builder.new do
attrs = {
:xmlns => 'http://www.vmware.com/vcloud/v1.5',
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance'
Method request
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def request(params)
params = {
:expects => 200,
:method => 'GET'
}.merge!(params)
Method do_request
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def do_request(params)
# Convert the uri to a URI if it's a string.
if params[:uri].is_a?(String)
params[:uri] = URI.parse(params[:uri])
end