ManageIQ/azure-armrest

View on GitHub

Showing 53 of 85 total issues

Method create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def create(vm_name, ext_name, options = {}, rgroup = nil)
        rgroup ||= options.delete(:resource_group) || configuration.resource_group

        raise ArgumentError, "no resource group provided" unless rgroup

Severity: Minor
Found in lib/azure/armrest/virtual_machine_extension_service.rb - About 35 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 delete_associated_resources has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def delete_associated_resources(vmname, vmgroup, options = {})
        options = {
          :network_interfaces      => true,
          :ip_addresses            => true,
          :os_disk                 => true,
Severity: Minor
Found in lib/azure/armrest/virtual_machine_service.rb - About 35 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 wait has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def wait(response, max_time = 60, default_interval = 10)
        sleep_time = response.respond_to?(:retry_after) ? response.retry_after.to_i : default_interval
        total_time = 0

        until (status = poll(response)) =~ /^succe/i # success or succeeded
Severity: Minor
Found in lib/azure/armrest/armrest_service.rb - About 35 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 delete_and_wait has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def delete_and_wait(service, name, group, options)
        resource_type = service.class.to_s.sub('Service', '').split('::').last

        log("Deleting #{resource_type} #{name}/#{group}") if options[:verbose]

Severity: Minor
Found in lib/azure/armrest/virtual_machine_service.rb - About 35 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 parse_uri has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def parse_uri(uri)
        uri = Addressable::URI.parse(uri)
        host_components = uri.host.split('.')

        rh = {
Severity: Minor
Found in lib/azure/armrest/storage_account_service.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def initialize(json, skip_accessors_definition = false)
        # Find the exclusion list for the model of next level (@embed_model)
        # '#' is the separator between levels. Remove attributes
        # before the first separator.
        @child_excl_list = self.class.send(:excl_list).map do |e|
Severity: Minor
Found in lib/azure/armrest/model/base_model.rb - About 35 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 set_provider_api_versions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def set_provider_api_versions
        # A lookup table for getting api-version strings per provider and service.
        @provider_api_versions = Hash.new { |hash, key| hash[key] = {} }

        providers.each do |rp|
Severity: Minor
Found in lib/azure/armrest/configuration.rb - About 25 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 list_metrics has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def list_metrics(resource, options = {})
          resource_id = resource.respond_to?(:id) ? resource.id : resource
          options[:filter] = options if options.is_a?(String) # For backwards compatibility

          url = File.join(
Severity: Minor
Found in lib/azure/armrest/insights/metrics_service.rb - About 25 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 create_blob_snapshot has a Cognitive Complexity of 6 (exceeds 5 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 25 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 raise_api_exception has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def raise_api_exception(err)
          begin
            content_type_header = err.response.headers[:content_type]

            response = case content_type_header.match(%r{(application/\w+)})[1]
Severity: Minor
Found in lib/azure/armrest/armrest_service.rb - About 25 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 add_file_content has a Cognitive Complexity of 6 (exceeds 5 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 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

      def initialize(options)
        options.symbolize_keys.each do |key, value|
          raise ArgumentError, "Invalid key '#{key}'" unless VALID_KEYS.include?(key)
          instance_variable_set("@#{key}", value)
        end
Severity: Minor
Found in lib/azure/armrest/environment.rb - About 25 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 read has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def read(options = {})
            retries = 0
            begin
              @storage_service.read(@sas_url, options)
            rescue Azure::Armrest::ForbiddenException => err
Severity: Minor
Found in lib/azure/armrest/storage/managed_disk.rb - About 25 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

Severity
Category
Status
Source
Language