fog/fog-azure-rm

View on GitHub

Showing 528 of 528 total issues

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

      Method get_network_interface_object has 12 arguments (exceeds 4 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)

        Method add_address_prefixes_in_virtual_network has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        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

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

            Method get_network_interface has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            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',
            Severity: Minor
            Found in lib/fog/azurerm/requests/network/get_network_interface.rb - About 1 hr to fix

              Method initialize has 36 lines of code (exceeds 25 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

                Method get_managed_vm_storage_profile has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                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]
                Severity: Minor
                Found in lib/fog/azurerm/requests/compute/create_virtual_machine.rb - About 1 hr to fix

                  Method get_unmanaged_vm_storage_profile has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  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]
                  Severity: Minor
                  Found in lib/fog/azurerm/requests/compute/create_virtual_machine.rb - About 1 hr to fix

                    Method parse has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                            def self.parse(load_balancer)
                              hash = {}
                              hash['id'] = load_balancer.id
                              hash['name'] = load_balancer.name
                              hash['location'] = load_balancer.location
                    Severity: Minor
                    Found in lib/fog/azurerm/models/network/load_balancer.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 attach_data_disk_to_vm has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    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]
                    Severity: Minor
                    Found in lib/fog/azurerm/requests/compute/attach_data_disk_to_vm.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 multipart_save_block_blob has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    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
                    Severity: Minor
                    Found in lib/fog/azurerm/requests/storage/multipart_save_block_blob.rb - About 1 hr to fix

                      Method list_zones has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              def list_zones
                                [
                                  {
                                    'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog_test_rg/providers/Microsoft.Network/dnszones/testfog1.com',
                                    'name' => 'testfog1.com',
                      Severity: Minor
                      Found in lib/fog/azurerm/requests/dns/list_zones.rb - About 1 hr to fix

                        Method define_load_balancer has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        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
                        Severity: Minor
                        Found in lib/fog/azurerm/requests/network/create_load_balancer.rb - About 1 hr to fix

                          Method save_page_blob has 33 lines of code (exceeds 25 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

                            Method parse has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    def self.parse(load_balancer)
                                      hash = {}
                                      hash['id'] = load_balancer.id
                                      hash['name'] = load_balancer.name
                                      hash['location'] = load_balancer.location
                            Severity: Minor
                            Found in lib/fog/azurerm/models/network/load_balancer.rb - About 1 hr to fix

                              Method list_blobs has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      def list_blobs(container_name, options = {})
                                        options = options.dup
                                        options[:metadata] = true
                                        next_marker = nil
                                        blobs = []
                              Severity: Minor
                              Found in lib/fog/azurerm/requests/storage/list_blobs.rb - About 1 hr to fix

                                Method list_containers has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        def list_containers
                                          [
                                            {
                                              'name' => 'test_container1',
                                              'metadata' => {},
                                Severity: Minor
                                Found in lib/fog/azurerm/requests/storage/list_containers.rb - About 1 hr to fix

                                  Method create_block_blob has 32 lines of code (exceeds 25 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

                                    Method parse has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                            def self.parse(network_gateway)
                                              hash = {}
                                              hash['id'] = network_gateway.id
                                              hash['name'] = network_gateway.name
                                              hash['location'] = network_gateway.location
                                    Severity: Minor
                                    Found in lib/fog/azurerm/models/network/virtual_network_gateway.rb - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language