Showing 103 of 135 total issues
Method call
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def call(env)
@env = env
cfg = env[:machine].provider_config
cnx = cfg.vcloud_cnx.driver
- Create a ticketCreate a ticket
Method get_edge_gateway_rules
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_edge_gateway_rules(edge_gateway_name, vdc_id)
edge_gateway_id = find_edge_gateway_id(edge_gateway_name, vdc_id)
params = {
'method' => :get,
- Create a ticketCreate a ticket
Method send_request
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def send_request(params, payload = nil, content_type = nil)
# Create a new HTTP client
clnt = HTTPClient.new
# Set SSL proto to TLSv1
- Read upRead up
- Create a ticketCreate a ticket
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 remove_edge_gateway_rules
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def remove_edge_gateway_rules(edge_gateway_name, vdc_id, edge_gateway_ip, vapp_id)
edge_vapp_ip = get_vapp_edge_public_ip(vapp_id)
edge_gateway_id = find_edge_gateway_id(edge_gateway_name, vdc_id)
params = {
- Create a ticketCreate a ticket
Method get_vapp_port_forwarding_rules
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_vapp_port_forwarding_rules(vapp_id, network_name=nil)
params = {
'method' => :get,
'command' => "/vApp/vapp-#{vapp_id}/networkConfigSection"
}
- Create a ticketCreate a ticket
Method get_vapp_port_forwarding_rules
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def get_vapp_port_forwarding_rules(vapp_id, network_name=nil)
params = {
'method' => :get,
'command' => "/vApp/vapp-#{vapp_id}/networkConfigSection"
}
- Read upRead up
- Create a ticketCreate a ticket
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 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_organization(org_id)
params = {
'method' => :get,
'command' => "/org/#{org_id}"
}
- Create a ticketCreate a ticket
Method compile_forwarded_ports
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def compile_forwarded_ports(machine)
mappings = {}
machine.config.vm.networks.each do |type, options|
if type == :forwarded_port
- Create a ticketCreate a ticket
Method set_vapp_port_forwarding_rules
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_vapp_port_forwarding_rules(vapp_id, network_name, config = {})
builder = Nokogiri::XML::Builder.new do |xml|
xml.NetworkConfigSection(
'xmlns' => 'http://www.vmware.com/vcloud/v1.5',
'xmlns:ovf' => 'http://schemas.dmtf.org/ovf/envelope/1') {
- Create a ticketCreate a ticket
Method get_vm
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_vm(vm_id)
params = {
'method' => :get,
'command' => "/vApp/vm-#{vm_id}"
}
- Create a ticketCreate a ticket
Method get_vapp_edge_public_ip
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_vapp_edge_public_ip(vapp_id, network_name=nil)
return @cached_vapp_edge_public_ips["#{vapp_id}#{network_name}"] unless @cached_vapp_edge_public_ips["#{vapp_id}#{network_name}"].nil?
# Check the network configuration section
params = {
- Create a ticketCreate a ticket
Method vcloud_upload_box
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def vcloud_upload_box(env)
cfg = env[:machine].provider_config
cnx = cfg.vcloud_cnx.driver
box_dir = env[:machine].box.directory.to_s
- Create a ticketCreate a ticket
Method get_vapp
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_vapp(vapp_id)
params = {
'method' => :get,
'command' => "/vApp/vapp-#{vapp_id}"
}
- Create a ticketCreate a ticket
Method find_edge_gateway_network
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def find_edge_gateway_network(edge_gateway_name, vdc_id, edge_gateway_ip)
params = {
'method' => :get,
'command' => '/query?type=edgeGateway&' \
'format=records&' \
- Create a ticketCreate a ticket
Method call
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def call(env)
config = env[:machine].provider_config
if !config.vcloud_cnx or !config.vcloud_cnx.driver.auth_key
@logger.info('Connecting to vCloud Director...')
- Create a ticketCreate a ticket
Method call
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def call(env)
cfg = env[:machine].provider_config
cnx = cfg.vcloud_cnx.driver
vapp_id = env[:machine].get_vapp_id
- Create a ticketCreate a ticket
Method set_metadata
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_metadata(link, data)
params = {
'method' => :post,
'command' => "/#{link}/metadata"
}
- Create a ticketCreate a ticket
Method action_ssh
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.action_ssh
Vagrant::Action::Builder.new.tap do |b|
# b.use ConfigValidate
b.use Call, IsCreated do |env, b2|
unless env[:result]
- Read upRead up
- Create a ticketCreate a ticket
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 add_vapp_port_forwarding_rules
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_vapp_port_forwarding_rules(vapp_id, network_name, edge_network_name, config = {})
params = {
'method' => :get,
'command' => "/vApp/vapp-#{vapp_id}/networkConfigSection"
}
- Create a ticketCreate a ticket
Method call
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def call(env)
cfg = env[:machine].provider_config
cnx = cfg.vcloud_cnx.driver
vapp_id = env[:machine].get_vapp_id
vm_name = cfg.name ? cfg.name.to_sym : env[:machine].name
- Create a ticketCreate a ticket