Showing 207 of 528 total issues
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_virtual_machine
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Method list_databases
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def list_databases(*)
[
{
'location' => '{database-location}',
'properties' => {
Method list_containers
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
def list_containers
options = { metadata: true }
containers = []
msg = nil
- 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_load_balancer
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def create_load_balancer(name, location, resource_group, frontend_ip_configurations, backend_address_pool_names, load_balancing_rules, probes, inbound_nat_rules, inbound_nat_pools, tags)
Method save
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
def save(options = {})
requires :key
is_create = options.delete(:is_create)
if is_create.nil? || is_create
- 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 format_database_parameters
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def format_database_parameters(location, create_mode, edition, source_database_id, collation, max_size_bytes, requested_service_objective_name, elastic_pool_name, requested_service_objective_id, tags)
Method parse
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.parse(nic)
hash = {}
hash['id'] = nic.id
hash['name'] = nic.name
hash['location'] = nic.location
Method list_available_sizes_for_virtual_machine
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def list_available_sizes_for_virtual_machine(*)
vm_sizes =
{
'value' => [
{
Method virtual_machine_params
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def virtual_machine_params(ssh_key_path)
{
resource_group: resource_group,
name: name,
location: location,
Method get_virtual_network
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def get_virtual_network(*)
virtual_network = {
'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-rg/providers/Microsoft.Network/virtualNetworks/fog-vnet',
'name' => 'fog-vnet',
'type' => 'Microsoft.Network/virtualNetworks',
Method parse
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.parse(recordset)
hash = get_hash_from_object(recordset)
hash['resource_group'] = get_resource_group_from_id(recordset.id)
hash['zone_name'] = get_record_set_from_id(recordset.id)
type = get_type_from_recordset_type(recordset.type)
Method list_subnets
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def list_subnets(resource_group, virtual_network_name)
subnet = {
'value' => [
{
'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/virtualNetworks/#{virtual_network_name}/subnets/subnet_0_testVnet",
Method list_vaults
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def list_vaults(*)
vaults = [
{
'id' => '/subscriptions/<AZURE_SUBSCRIPTION_ID>/resourceGroups/RubySDKTest_azure_mgmt_kv/providers/Microsoft.KeyVault/vaults/sampleVault758347',
'name' => 'sampleVault758347',
Method create_or_update__virtual_network
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def create_or_update__virtual_network(*)
virtual_network = {
'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-rg/providers/Microsoft.Network/virtualNetworks/fog-vnet',
'name' => 'fog-vnet',
'type' => 'Microsoft.Network/virtualNetworks',
Method list_express_route_circuits
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def list_express_route_circuits(*)
[
{
'name' => 'testCircuit',
'id' => '/subscriptions/########-####-####-####-############/resourceGroup/resource_group_name/providers/Microsoft.Network/expressRouteCircuits/circuitName',
Method parse
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.parse(circuit)
express_route_circuit = {}
express_route_circuit['id'] = circuit.id
express_route_circuit['name'] = circuit.name
express_route_circuit['location'] = circuit.location
Method create_disk
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def create_disk(disk_name, disk_size_in_gb, options = {})
msg = "Creating disk(#{disk_name}, #{disk_size_in_gb}). options: #{options}"
Fog::Logger.debug msg
raise ArgumentError, "disk_size_in_gb #{disk_size_in_gb} must be an integer" unless disk_size_in_gb.is_a?(Integer)
Method define_load_balancer
has 9 arguments (exceeds 4 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)
Method get_vault
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def get_vault(*)
vault = {
'id' => '/subscriptions/<AZURE_SUBSCRIPTION_ID>/resourceGroups/RubySDKTest_azure_mgmt_kv/providers/Microsoft.KeyVault/vaults/sampleVault758347',
'name' => 'sampleVault758347',
'type' => 'Microsoft.KeyVault/vaults',