fog/fog-azure-rm

View on GitHub

Showing 528 of 528 total issues

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

            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

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

              def list_databases(*)
                [
                  {
                    'location' => '{database-location}',
                    'properties' => {
      Severity: Minor
      Found in lib/fog/azurerm/requests/sql/list_databases.rb - About 1 hr to fix

        Method save has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

                def save(options = {})
                  requires :key
        
                  is_create = options.delete(:is_create)
                  if is_create.nil? || is_create
        Severity: Minor
        Found in lib/fog/azurerm/models/storage/directory.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_load_balancer has 10 arguments (exceeds 4 allowed). Consider refactoring.
        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)
        Severity: Major
        Found in lib/fog/azurerm/requests/network/create_load_balancer.rb - About 1 hr to fix

          Method list_containers has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

                  def list_containers
                    options = { metadata: true }
                    containers = []
                    msg = nil
          
          
          Severity: Minor
          Found in lib/fog/azurerm/requests/storage/list_containers.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 format_database_parameters has 10 arguments (exceeds 4 allowed). Consider refactoring.
          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)
          Severity: Major
          Found in lib/fog/azurerm/requests/sql/create_or_update_database.rb - About 1 hr to fix

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

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

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

                        def virtual_machine_params(ssh_key_path)
                          {
                            resource_group: resource_group,
                            name: name,
                            location: location,
                Severity: Minor
                Found in lib/fog/azurerm/models/compute/server.rb - About 1 hr to fix

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

                    Method create_or_update__virtual_network has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    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 parse has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      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)
                      Severity: Minor
                      Found in lib/fog/azurerm/models/dns/record_set.rb - About 1 hr to fix

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

                          Method list_vaults has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  def list_vaults(*)
                                    vaults = [
                                      {
                                        'id' => '/subscriptions/<AZURE_SUBSCRIPTION_ID>/resourceGroups/RubySDKTest_azure_mgmt_kv/providers/Microsoft.KeyVault/vaults/sampleVault758347',
                                        'name' => 'sampleVault758347',
                          Severity: Minor
                          Found in lib/fog/azurerm/requests/key_vault/list_vaults.rb - About 1 hr to fix

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

                              Method list_express_route_circuits has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      def list_express_route_circuits(*)
                                        [
                                          {
                                            'name' => 'testCircuit',
                                            'id' => '/subscriptions/########-####-####-####-############/resourceGroup/resource_group_name/providers/Microsoft.Network/expressRouteCircuits/circuitName',
                              Severity: Minor
                              Found in lib/fog/azurerm/requests/network/list_express_route_circuits.rb - About 1 hr to fix

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

                                  Method define_load_balancer has 9 arguments (exceeds 4 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)
                                  Severity: Major
                                  Found in lib/fog/azurerm/requests/network/create_load_balancer.rb - About 1 hr to fix

                                    Method define_load_balancing_rule has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                            def define_load_balancing_rule(load_balancing_rules)
                                              load_balancing_rule_arr = []
                                              load_balancing_rules.each do |lbr|
                                                load_balancing_rule = Azure::ARM::Network::Models::LoadBalancingRule.new
                                    
                                    Severity: Minor
                                    Found in lib/fog/azurerm/requests/network/create_load_balancer.rb - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language