Showing 207 of 528 total issues
Method list_virtual_machines
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def list_virtual_machines(*)
vms = {
'value' => [
{
'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.Compute/virtualMachines/fog-test-server',
Method create_or_update_network_interface
has 14 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_or_update_network_interface(resource_group_name, name, location, subnet_id, public_ip_address_id, network_security_group_id, ip_config_name, private_ip_allocation_method, private_ip_address, load_balancer_backend_address_pools_ids, load_balancer_inbound_nat_rules_ids, tags, enable_accelerated_networking = false, async = false)
Method get_network_interface_object
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_network_interface_object(name, location, subnet_id, public_ip_address_id, network_security_group_id, ip_config_name, private_ip_allocation_method, private_ip_address, load_balancer_backend_address_pools_ids, load_balancer_inbound_nat_rules_ids, tags, enable_accelerated_networking)
if public_ip_address_id
public_ipaddress = Azure::ARM::Network::Models::PublicIPAddress.new
public_ipaddress.id = public_ip_address_id
end
Method list_network_interfaces
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def list_network_interfaces(resource_group)
nic =
{
'value' =>
[
Method create_load_balancer
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_load_balancer(_name, _location, _resource_group, _frontend_ip_configuration_name, _subnet_id, _private_ip_address, _private_ip_allocation_method, _public_ip_address_id, _backend_address_pool_names, _load_balancing_rules, _probes, _inbound_nat_rules, _inbound_nat_pools)
Method save
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def save(options = {})
update_body = options.delete(:update_body)
update_body = true if update_body.nil?
requires :directory, :key
raise ArgumentError.new('body is required when update_body is true') if update_body && attributes[:body].nil?
Method attach_resource_to_nic
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def attach_resource_to_nic(resource_group_name, nic_name, _resource_type, _resource_id)
nic = {
'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkInterfaces/#{nic_name}",
'name' => nic_name,
'type' => 'Microsoft.Network/networkInterfaces',
Method create_or_update_network_interface
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_or_update_network_interface(resource_group_name, name, location, subnet_id, public_ip_address_id, ip_configs_name, private_ip_allocation_method, private_ip_address)
nic = {
'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkInterfaces/#{name}",
'name' => name,
'type' => 'Microsoft.Network/networkInterfaces',
Method detach_resource_from_nic
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def detach_resource_from_nic(resource_group_name, nic_name, _resource_type)
nic = {
'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkInterfaces/#{nic_name}",
'name' => nic_name,
'type' => 'Microsoft.Network/networkInterfaces',
Method list_managed_disks_in_subscription
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def list_managed_disks_in_subscription
disks = [
{
'accountType' => 'Standard_LRS',
'properties' => {
Method list_managed_disks_by_rg
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def list_managed_disks_by_rg(*)
disks = [
{
'accountType' => 'Standard_LRS',
'properties' => {
Method save_page_blob
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def save_page_blob(container_name, blob_name, body, options)
threads_num = options.delete(:worker_thread_num)
threads_num = UPLOAD_BLOB_WORKER_THREAD_COUNT if threads_num.nil? || !threads_num.is_a?(Integer) || threads_num < 1
begin
- 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 create_block_blob
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def create_block_blob(container_name, blob_name, body, options = {})
options[:request_id] = SecureRandom.uuid
msg = "create_block_blob #{blob_name} to the container #{container_name}. options: #{options}"
Fog::Logger.debug msg
- 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 create_virtual_machine
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def create_virtual_machine(vm_config, async = false)
vm_name = vm_config[:name]
rg_name = vm_config[:resource_group]
# In case of updating the VM, we check if the user has passed any value for os_disk_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 initialize
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def initialize(options)
begin
require 'azure_mgmt_storage'
require 'azure/storage'
require 'securerandom'
- 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 add_subnets_in_virtual_network
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_subnets_in_virtual_network(*)
virtual_network = {
'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-rg/providers/Microsoft.Network/virtualNetworks/fog-vnet',
'name' => 'fog-vnet',
'type' => 'Microsoft.Network/virtualNetworks',
Method add_dns_servers_in_virtual_network
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_dns_servers_in_virtual_network(*)
virtual_network = {
'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-rg/providers/Microsoft.Network/virtualNetworks/fog-vnet',
'name' => 'fog-vnet',
'type' => 'Microsoft.Network/virtualNetworks',
Method remove_address_prefixes_from_virtual_network
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def remove_address_prefixes_from_virtual_network(*)
virtual_network = {
'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-rg/providers/Microsoft.Network/virtualNetworks/fog-vnet',
'name' => 'fog-vnet',
'type' => 'Microsoft.Network/virtualNetworks',
Method remove_dns_servers_from_virtual_network
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def remove_dns_servers_from_virtual_network(*)
virtual_network = {
'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-rg/providers/Microsoft.Network/virtualNetworks/fog-vnet',
'name' => 'fog-vnet',
'type' => 'Microsoft.Network/virtualNetworks',
Method list_record_sets
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def list_record_sets(*)
[
{
'id' => '/subscriptions/########-####-####-####-############/resourceGroups/resource_group/providers/Microsoft.Network/dnszones/zone_name/A/test_record',
'name' => 'test_record',