Showing 248 of 460 total issues
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 = {
Method put_network
has 61 lines of code (exceeds 25 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})\"."
Method instantiate_vapp_template
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
def instantiate_vapp_template(vapp_name, template_id, options={})
unless data[:catalog_items].values.find {|i| i[:template_id] == template_id}
raise Fog::Compute::VcloudDirector::Forbidden.new(
'No such template.'
)
Method post_capture_vapp
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def post_capture_vapp(vdc_id, name, source_id, 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
Method get_organization
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_organization(id)
unless id == data[:org][:uuid]
raise Fog::Compute::VcloudDirector::Forbidden.new(
"No access to entity \"com.vmware.vcloud.entity.org:#{id}\""
)
Method template_pool
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
def template_pool(filter = { })
templates = ::OpenNebula::TemplatePool.new(client)
if filter[:id].nil?
templates.info!(-2,-1,-1)
Method save
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def save
unless persisted?
#Lame ...
raise RuntimeError, "Should not be here"
else
Method []
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.[](service)
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :auto_scaling
Fog::AWS::AutoScaling.new
Method create_server
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_server(image_id, options = {})
raise Excon::Errors::BadRequest.new("Invalid image ID") unless image_id > 0
response = Excon::Response.new
response.status = 202
Method post_upload_disk
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def post_upload_disk(id, name, size, options={})
body = Nokogiri::XML::Builder.new do
DiskCreateParams(:xmlns => 'http://www.vmware.com/vcloud/v1.5') {
attrs = {
: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 former_mvp?
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def former_mvp?(committer)
[
'Aaron Suggs',
'Akira Matsuda',
'ller', #"Achim Ledermüller" UTF-8 fail?
Method build_source_items
has 54 lines of code (exceeds 25 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])
Method post_upload_media
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def post_upload_media(vdc_id, name, image_type, size, options={})
unless ['iso','floppy'].include?(image_type)
raise Fog::Compute::VcloudDirector::BadRequest.new(
'The value of parameter imageType is incorrect.'
)
Method data
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.data
@data ||= Hash.new do |hash, key|
hash[key] = {
"vms" => [
{
Method media_body
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def media_body(id)
media = data[:medias][id]
body = {
:size => media[:size].to_s,
Method post_instantiate_vapp_template
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def post_instantiate_vapp_template(vdc_id, vapp_template_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 generate_xml
has 49 lines of code (exceeds 25 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'
Method class_for
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.class_for(key)
case key
when :auto_scaling
Fog::AWS::AutoScaling
when :beanstalk
Method disk_body
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def disk_body(id)
disk = data[:disks][id]
storage_class_id = disk[:vdc_storage_class]
body = {
Method get_execute_query
has a Cognitive Complexity of 15 (exceeds 5 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
- 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"