fog/fog-azure-rm

View on GitHub

Showing 207 of 528 total issues

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

        def self.parse(vm)
          hash = {}
          hash['id'] = vm.id
          hash['name'] = vm.name
          hash['location'] = vm.location
Severity: Minor
Found in lib/fog/azurerm/models/compute/server.rb - About 2 hrs 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 parse has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def self.parse(gateway)
          hash = {}
          hash['name'] = gateway.name
          hash['id'] = gateway.id
          hash['location'] = gateway.location
Severity: Major
Found in lib/fog/azurerm/models/application_gateway/gateway.rb - About 2 hrs to fix

    Method attach_data_disk_to_vm has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def attach_data_disk_to_vm(*)
              vm = {
                'location' => 'West US',
                'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.Compute/virtualMachines/fog-test-server',
                'name' => 'fog-test-server',
    Severity: Major
    Found in lib/fog/azurerm/requests/compute/attach_data_disk_to_vm.rb - About 2 hrs to fix

      Method detach_data_disk_from_vm has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def detach_data_disk_from_vm(*)
                vm = {
                  'location' => 'West US',
                  'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.Compute/virtualMachines/fog-test-server',
                  'name' => 'fog-test-server',
      Severity: Major
      Found in lib/fog/azurerm/requests/compute/detach_data_disk_from_vm.rb - About 2 hrs to fix

        Method create_virtual_machine has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def create_virtual_machine(*)
                  vm = {
                    'location' => 'westus',
                    'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.Compute/virtualMachines/fog-test-server',
                    'name' => 'fog-test-server',
        Severity: Major
        Found in lib/fog/azurerm/requests/compute/create_virtual_machine.rb - About 2 hrs to fix

          Method get_virtual_machine has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def get_virtual_machine(*)
                    vm = {
                      'location' => 'westus',
                      'id' => '/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.Compute/virtualMachines/fog-test-server',
                      'name' => 'fog-test-server',
          Severity: Major
          Found in lib/fog/azurerm/requests/compute/get_virtual_machine.rb - About 2 hrs to fix

            Method create_block_blob has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def create_block_blob(_container_name, _blob_name, body, _options = {})
                      Fog::Logger.debug 'Blob created successfully.'
                      if body.nil?
                        {
                          'name' => 'test_blob',
            Severity: Major
            Found in lib/fog/azurerm/requests/storage/create_block_blob.rb - About 2 hrs to fix

              Method list_traffic_manager_profiles has 56 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def list_traffic_manager_profiles(*)
                        profiles = [
                          {
                            'location' => 'global',
                            'tags' => {},

                Method get_deployment has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        def get_deployment(*)
                          deployments = {
                            id: "/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/microsoft.resources/deployments/testdeployment",
                            name: 'testdeployment',
                            properties: {
                Severity: Major
                Found in lib/fog/azurerm/requests/resources/get_deployment.rb - About 2 hrs to fix

                  Method get_traffic_manager_profile has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          def get_traffic_manager_profile(*)
                            profile = {
                              'location' => 'global',
                              'tags' => {},
                              'properties' => {

                    Method create_or_update_traffic_manager_profile has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            def create_or_update_traffic_manager_profile(*)
                              profile = {
                                'location' => 'global',
                                'tags' => {},
                                'properties' => {

                      File create_or_update_application_gateway.rb has 256 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      module Fog
                        module ApplicationGateway
                          class AzureRM
                            # Real class for Application Gateway Request
                            class Real

                        Method format_database_parameters has a Cognitive Complexity of 16 (exceeds 5 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)
                                  database = Azure::ARM::SQL::Models::Database.new
                                  database.location = location
                                  database.edition = edition unless edition.nil?
                                  database.collation = collation unless collation.nil?
                        Severity: Minor
                        Found in lib/fog/azurerm/requests/sql/create_or_update_database.rb - About 2 hrs 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 list_deployments has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                def list_deployments(resource_group)
                                  deployments = {
                                    value: [{
                                      id: "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/microsoft.resources/deployments/testdeployment",
                                      name: 'testdeployment',
                        Severity: Major
                        Found in lib/fog/azurerm/requests/resources/list_deployments.rb - About 2 hrs to fix

                          Method list_virtual_networks has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  def list_virtual_networks(resource_group)
                                    virtual_network = {
                                      'value' => [
                                        {
                                          'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/virtualNetworks/testVnet",
                          Severity: Minor
                          Found in lib/fog/azurerm/requests/network/list_virtual_networks.rb - About 1 hr to fix

                            Method list_virtual_networks_in_subscription has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    def list_virtual_networks_in_subscription
                                      virtual_network = {
                                        'value' => [
                                          {
                                            'id' => '/subscriptions/########-####-####-####-############/resourceGroups/TestRG/providers/Microsoft.Network/virtualNetworks/testVnet',

                              Method create_deployment has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      def create_deployment(resource_group, deployment_name, template_link, parameters_link)
                                        deployment = {
                                          id: "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/microsoft.resources/deployments/#{deployment_name}",
                                          name: deployment_name,
                                          properties: {
                              Severity: Minor
                              Found in lib/fog/azurerm/requests/resources/create_deployment.rb - About 1 hr to fix

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

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

                                  Method get_blob_with_block_given has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                          def get_blob_with_block_given(container_name, blob_name, options, &_block)
                                            options[:request_id] = SecureRandom.uuid
                                            msg = "get_blob_with_block_given: blob #{blob_name} in the container #{container_name}. options: #{options}"
                                            Fog::Logger.debug msg
                                  
                                  
                                  Severity: Minor
                                  Found in lib/fog/azurerm/requests/storage/get_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 get_blob_with_block_given has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                          def get_blob_with_block_given(container_name, blob_name, options, &_block)
                                            options[:request_id] = SecureRandom.uuid
                                            msg = "get_blob_with_block_given: blob #{blob_name} in the container #{container_name}. options: #{options}"
                                            Fog::Logger.debug msg
                                  
                                  
                                  Severity: Minor
                                  Found in lib/fog/azurerm/requests/storage/get_blob.rb - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language