fog/fog-azure-rm

View on GitHub

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',
Severity: Minor
Found in lib/fog/azurerm/requests/compute/list_virtual_machines.rb - About 1 hr to fix

    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' =>
                        [
        Severity: Minor
        Found in lib/fog/azurerm/requests/network/list_network_interfaces.rb - About 1 hr to fix

          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)
          Severity: Major
          Found in lib/fog/azurerm/requests/network/create_load_balancer.rb - About 1 hr to fix

            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',
            Severity: Minor
            Found in lib/fog/azurerm/requests/network/detach_resource_from_nic.rb - About 1 hr to fix

              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 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',
                Severity: Minor
                Found in lib/fog/azurerm/requests/network/attach_resource_to_nic.rb - About 1 hr to fix

                  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?
                  Severity: Minor
                  Found in lib/fog/azurerm/models/storage/file.rb - About 1 hr to fix

                    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' => {
                    Severity: Minor
                    Found in lib/fog/azurerm/requests/compute/list_managed_disks_by_rg.rb - About 1 hr to fix

                      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 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
                        Severity: Minor
                        Found in lib/fog/azurerm/requests/storage/save_page_blob.rb - About 1 hr to fix

                        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
                        
                        
                        Severity: Minor
                        Found in lib/fog/azurerm/requests/storage/create_block_blob.rb - About 1 hr to fix

                        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'
                        Severity: Minor
                        Found in lib/fog/azurerm/storage.rb - About 1 hr to fix

                        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
                        Severity: Minor
                        Found in lib/fog/azurerm/requests/compute/create_virtual_machine.rb - About 1 hr to fix

                        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',
                        Severity: Minor
                        Found in lib/fog/azurerm/requests/network/add_subnets_in_virtual_network.rb - About 1 hr to fix

                          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 get_managed_disk has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      def get_managed_disk(*)
                                        disk = {
                                          'accountType' => 'Standard_LRS',
                                          'properties' => {
                                            'osType' => 'Windows',
                              Severity: Minor
                              Found in lib/fog/azurerm/requests/compute/get_managed_disk.rb - About 1 hr to fix

                                Method create_or_update_managed_disk has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        def create_or_update_managed_disk(*)
                                          disk = {
                                            'accountType' => 'Standard_LRS',
                                            'properties' => {
                                              'osType' => 'Windows',
                                Severity: Minor
                                Found in lib/fog/azurerm/requests/compute/create_or_update_managed_disk.rb - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language