Showing 207 of 528 total issues
Method list_record_sets
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def list_record_sets(*)
[
{
'id' => '/subscriptions/########-####-####-####-############/resourceGroups/resource_group/providers/Microsoft.Network/dnszones/zone_name/A/test_record',
'name' => 'test_record',
Method create_or_update_managed_disk
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def create_or_update_managed_disk(*)
disk = {
'accountType' => 'Standard_LRS',
'properties' => {
'osType' => 'Windows',
Method get_network_interface_object
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
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)
Method add_address_prefixes_in_virtual_network
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def add_address_prefixes_in_virtual_network(*)
{
'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-rg/providers/Microsoft.Network/virtualNetworks/fog-vnet',
'name' => 'fog-vnet',
'type' => 'Microsoft.Network/virtualNetworks',
Method attach_data_disk_to_vm
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def attach_data_disk_to_vm(disk_params, async)
# Variable un-packing for easy access
vm_name = disk_params[:vm_name]
vm_resource_group = disk_params[:vm_resource_group]
disk_name = disk_params[:disk_name]
Method get_network_interface
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def get_network_interface(resource_group_name, nic_name)
nic = {
'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkInterfaces/#{nic_name}",
'name' => nic_name,
'type' => 'Microsoft.Network/networkInterfaces',
Method get_unmanaged_vm_storage_profile
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def get_unmanaged_vm_storage_profile(vm_config)
# Arguments unpacking
vm_name = vm_config[:name]
storage_account_name = vm_config[:storage_account_name]
publisher = vm_config[:publisher]
Method get_managed_vm_storage_profile
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def get_managed_vm_storage_profile(vm_config)
# Argument unpacking
managed_disk_storage_type = vm_config[:managed_disk_storage_type]
vhd_path = vm_config[:vhd_path]
resource_group = vm_config[:resource_group]
Method initialize
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize(options)
begin
require 'azure_mgmt_storage'
require 'azure/storage'
require 'securerandom'
Method parse
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
def self.parse(load_balancer)
hash = {}
hash['id'] = load_balancer.id
hash['name'] = load_balancer.name
hash['location'] = load_balancer.location
- 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 attach_data_disk_to_vm
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
def attach_data_disk_to_vm(disk_params, async)
# Variable un-packing for easy access
vm_name = disk_params[:vm_name]
vm_resource_group = disk_params[:vm_resource_group]
disk_name = disk_params[: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 multipart_save_block_blob
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def multipart_save_block_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
Method list_zones
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def list_zones
[
{
'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog_test_rg/providers/Microsoft.Network/dnszones/testfog1.com',
'name' => 'testfog1.com',
Method parse
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.parse(load_balancer)
hash = {}
hash['id'] = load_balancer.id
hash['name'] = load_balancer.name
hash['location'] = load_balancer.location
Method save_page_blob
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Method define_load_balancer
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def define_load_balancer(name, location, frontend_ip_configurations, backend_address_pool_names, load_balancing_rules, probes, inbound_nat_rules, inbound_nat_pools, tags)
load_balancer = Azure::ARM::Network::Models::LoadBalancer.new
load_balancer.name = name
load_balancer.location = location
load_balancer.tags = tags
Method list_blobs
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def list_blobs(container_name, options = {})
options = options.dup
options[:metadata] = true
next_marker = nil
blobs = []
Method wait_blob_copy_operation_to_finish
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def wait_blob_copy_operation_to_finish(container_name, blob_name, copy_id, copy_status, timeout = nil)
begin
start_time = Time.new
while copy_status == COPY_STATUS[:PENDING]
blob = get_blob_properties(container_name, blob_name)
Method create_block_blob
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Method list_containers
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def list_containers
[
{
'name' => 'test_container1',
'metadata' => {},