fog/fog-azure-rm

View on GitHub
lib/fog/azurerm/requests/compute/attach_data_disk_to_vm.rb

Summary

Maintainability
B
6 hrs
Test Coverage
F
14%

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 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 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 get_unmanaged_disk_object has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              def get_unmanaged_disk_object(disk_name, disk_size, lun, storage_account_name, access_key)
      Severity: Minor
      Found in lib/fog/azurerm/requests/compute/attach_data_disk_to_vm.rb - About 35 mins to fix

        Use 2 (not 0) spaces for indentation.
        Open

                    raise_azure_exception(e, msg)

        This cops checks for indentation that doesn't use the specified number of spaces.

        See also the IndentationConsistency cop which is the companion to this one.

        Example:

        # bad
        class A
         def test
          puts 'hello'
         end
        end
        
        # good
        class A
          def test
            puts 'hello'
          end
        end

        Example: IgnoredPatterns: ['^\s*module']

        # bad
        module A
        class B
          def test
          puts 'hello'
          end
        end
        end
        
        # good
        module A
        class B
          def test
            puts 'hello'
          end
        end
        end

        There are no issues that match your filters.

        Category
        Status