ManageIQ/azure-armrest

View on GitHub

Showing 53 of 85 total issues

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

      def get_blob_raw(container, blob, key = access_key, options = {})
        raise ArgumentError, "No access key specified" unless key

        url = File.join(properties.primary_endpoints.blob, container, blob)
        url += "?snapshot=" + options[:date] if options[:date]
Severity: Minor
Found in lib/azure/armrest/model/storage_account.rb - About 1 hr to fix

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

          def delete_unmanaged_storage(vm, options)
            sas = Azure::Armrest::StorageAccountService.new(configuration)
    
            storage_account = sas.get_from_vm(vm)
    
    
    Severity: Minor
    Found in lib/azure/armrest/virtual_machine_service.rb - About 1 hr to fix

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

        def read(sas_url, options = {})
          # The same restrictions that apply to the StorageAccount method also apply here.
          range = options[:range] if options[:range]
          range ||= options[:start_byte]..options[:end_byte] if options[:start_byte] && options[:end_byte]
          range ||= options[:start_byte]..options[:start_byte] + options[:length] - 1 if options[:start_byte] && options[:length]
      Severity: Minor
      Found in lib/azure/armrest/storage/managed_storage_helper.rb - About 1 hr to fix

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

              def add_file_content(share, file, key = access_key, options = {})
                raise ArgumentError, "No access key specified" unless key
        
                timeout = options.delete(:timeout)
                content = options.delete(:content)
        Severity: Minor
        Found in lib/azure/armrest/model/storage_account.rb - About 1 hr to fix

          Method files has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def files(share, key = access_key, options = {})
                  raise ArgumentError, "No access key specified" unless key
          
                  query = "comp=list&restype=directory"
          
          
          Severity: Minor
          Found in lib/azure/armrest/model/storage_account.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 build_id_string has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def build_id_string(resource_group = nil, *args)
                  id_string = File.join('', 'subscriptions', configuration.subscription_id)
                  id_string = File.join(id_string, 'resourceGroups', resource_group) if resource_group
                  id_string = File.join(id_string, 'providers', @provider, @service_name)
          
          
          Severity: Minor
          Found in lib/azure/armrest/resource_group_based_service.rb - About 1 hr to fix

            Method delete_associated_nics has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def delete_associated_nics(vm, options)
                    nis = Azure::Armrest::Network::NetworkInterfaceService.new(configuration)
                    nics = vm.properties.network_profile.network_interfaces.map(&:id)
            
                    if options[:ip_addresses]
            Severity: Minor
            Found in lib/azure/armrest/virtual_machine_service.rb - About 1 hr to fix

              Method initialize has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def initialize(args)
                      # Use defaults, and override with provided arguments
                      options = {
                        :api_version   => '2015-01-01',
                        :accept        => 'application/json',
              Severity: Minor
              Found in lib/azure/armrest/configuration.rb - About 1 hr to fix

                Method create_blob_snapshot has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def create_blob_snapshot(container, blob, key = access_key, options = {})
                        raise ArgumentError, "No access key specified" unless key
                
                        timeout = options.delete(:timeout) # Part of request
                
                
                Severity: Minor
                Found in lib/azure/armrest/model/storage_account.rb - About 1 hr to fix

                  Method __setobj__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def __setobj__
                          excl_list = self.class.send(:excl_list)
                          @hashobj.each do |key, value|
                            snake = key.to_s.gsub(/\W/, '_').underscore
                  
                  
                  Severity: Minor
                  Found in lib/azure/armrest/model/base_model.rb - About 55 mins 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 containers has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def containers(key = access_key, options = {})
                          raise ArgumentError, "No access key specified" unless key
                  
                          query = "comp=list"
                          skip_defs = options[:skip_accessors_definition]
                  Severity: Minor
                  Found in lib/azure/armrest/model/storage_account.rb - About 55 mins 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 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def initialize(args)
                          # Use defaults, and override with provided arguments
                          options = {
                            :api_version   => '2015-01-01',
                            :accept        => 'application/json',
                  Severity: Minor
                  Found in lib/azure/armrest/configuration.rb - About 45 mins 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 has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                        def get(offer, sku, version, location = @location, publisher = @publisher)
                  Severity: Minor
                  Found in lib/azure/armrest/virtual_machine_image_service.rb - About 35 mins to fix

                    Method copy_blob has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                          def copy_blob(src_container, src_blob, dst_container, dst_blob = nil, key = access_key)
                    Severity: Minor
                    Found in lib/azure/armrest/model/storage_account.rb - About 35 mins to fix

                      Method file_response has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                            def file_response(key, query, request_type = 'get', payload = '', *args)
                      Severity: Minor
                      Found in lib/azure/armrest/model/storage_account.rb - About 35 mins to fix

                        Method copy_file has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                              def copy_file(src_container, src_file, dst_container = src_container, dst_file = nil, key = access_key)
                        Severity: Minor
                        Found in lib/azure/armrest/model/storage_account.rb - About 35 mins to fix

                          Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                def initialize(configuration, service_name, subservice_name, default_provider, options)
                          Severity: Minor
                          Found in lib/azure/armrest/resource_group_based_subservice.rb - About 35 mins to fix

                            Method rest_execute has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                  def rest_execute(url, body = nil, http_method = :get, encode = true, max_retries = 3)
                            Severity: Minor
                            Found in lib/azure/armrest/armrest_service.rb - About 35 mins to fix

                              Method build_url has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                      def build_url(provider, resource_type, resource_name, resource_group, options)
                              Severity: Minor
                              Found in lib/azure/armrest/insights/metrics_service.rb - About 35 mins to fix

                                Method list has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                        def list(provider, resource_type, resource_name, resource_group = nil, options = {})
                                Severity: Minor
                                Found in lib/azure/armrest/insights/metrics_service.rb - About 35 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language