aviator/aviator

View on GitHub

Showing 25 of 74 total issues

Method infer_version has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

      def infer_version(session_data, request_name, service)
        if session_data.has_key?(:auth_service) && session_data[:auth_service][:api_version]
        session_data[:auth_service][:api_version].to_sym

        elsif session_data.has_key?(:auth_service) && session_data[:auth_service][:host_uri]
Severity: Minor
Found in lib/aviator/openstack/provider.rb - About 4 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

Class Request has 27 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Request

    class ApiVersionNotDefinedError < StandardError
      def initialize
        super "api_version is not defined."
Severity: Minor
Found in lib/aviator/core/request.rb - About 3 hrs to fix

    Method find_request has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

          def find_request(service, name, session_data, options)
            service = service.to_s
            endpoint_type = options[:endpoint_type]
            endpoint_types = if endpoint_type
                               [StrUtil.camelize(endpoint_type.to_s)]
    Severity: Minor
    Found in lib/aviator/openstack/provider.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 request has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        def request(request_name, options={}, &params)
          if options[:api_version].nil? && @default_options[:api_version]
            options[:api_version] = @default_options[:api_version]
          end
    
    
    Severity: Minor
    Found in lib/aviator/core/service.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 describe_request has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.describe_request(provider_name, service_name, api_version, endpoint_type, request_name)
          service = Aviator::Service.new :provider => provider_name, :service => service_name
          request_class = "Aviator::#{ StrUtil.camelize(provider_name) }::#{ StrUtil.camelize(service_name) }::Requests::"\
                          "#{ StrUtil.camelize(api_version) }::#{ StrUtil.camelize(endpoint_type) }::#{ StrUtil.camelize(request_name) }"
          request_class = StrUtil.constantize(request_class)
    Severity: Minor
    Found in lib/aviator/core/cli/describer.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 describe_request has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def self.describe_request(provider_name, service_name, api_version, endpoint_type, request_name)
          service = Aviator::Service.new :provider => provider_name, :service => service_name
          request_class = "Aviator::#{ StrUtil.camelize(provider_name) }::#{ StrUtil.camelize(service_name) }::Requests::"\
                          "#{ StrUtil.camelize(api_version) }::#{ StrUtil.camelize(endpoint_type) }::#{ StrUtil.camelize(request_name) }"
          request_class = StrUtil.constantize(request_class)
    Severity: Minor
    Found in lib/aviator/core/cli/describer.rb - About 1 hr to fix

      Method base_url has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def base_url
            if session_data[:base_url]
              session_data[:base_url]
      
            elsif keystone_v2_style_session_data? && keystone_v2_style_service_info?
      Severity: Minor
      Found in lib/aviator/openstack/common/requests/v0/public/base.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 url has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def url
            str  = "#{ base_url }/volumes"
            str += "/detail" if params[:details]
      
            filters = []
      Severity: Minor
      Found in lib/aviator/openstack/volume/requests/v1/public/list_volumes.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 url has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def url
            str  = "#{ base_url }/servers"
            str += "/detail" if params[:details]
      
            filters = []
      Severity: Minor
      Found in lib/aviator/openstack/compute/requests/v2/public/list_servers.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_request_class has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

            def get_request_class(root_namespace, request_class_arr)
              provider_specific = request_class_arr != [:request]
      
              if provider_specific
                full_request_class_arr = request_class_arr.dup
      Severity: Minor
      Found in lib/aviator/core/request_builder.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 compact_hash has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def compact_hash(hash, opts = {})
            opts[:recurse] ||= true
            hash.inject({}) do |new_hash, (k,v)|
              if !v.nil?
                new_hash[k] = opts[:recurse] && v.kind_of?(Hash) ? compact_hash(v, opts) : v
      Severity: Minor
      Found in lib/aviator/openstack/identity/requests/v3/public/create_token.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 request has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def request(request_name, options={}, &params)
            if options[:api_version].nil? && @default_options[:api_version]
              options[:api_version] = @default_options[:api_version]
            end
      
      
      Severity: Minor
      Found in lib/aviator/core/service.rb - About 1 hr to fix

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

              def find_request(service, name, session_data, options)
                service = service.to_s
                endpoint_type = options[:endpoint_type]
                endpoint_types = if endpoint_type
                                   [StrUtil.camelize(endpoint_type.to_s)]
        Severity: Minor
        Found in lib/aviator/openstack/provider.rb - About 1 hr to fix

          Avoid deeply nested control flow statements.
          Open

                    raise Aviator::Service::MissingServiceEndpointError.new(service.to_s, request_name) unless service_specs.length > 0
          Severity: Major
          Found in lib/aviator/openstack/provider.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                      raise MultipleServiceApisError.new(service, service_specs, request_name) unless service_specs.length <= 1
            Severity: Major
            Found in lib/aviator/openstack/provider.rb - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                        version ? version[1].to_sym : :v1
              Severity: Major
              Found in lib/aviator/openstack/provider.rb - About 45 mins to fix

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

                    def self.describe_request(provider_name, service_name, api_version, endpoint_type, request_name)
                Severity: Minor
                Found in lib/aviator/core/cli/describer.rb - About 35 mins to fix

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

                      def body
                        p = if params[:tokenId]
                              {
                                :auth => {
                                  :token => {
                  Severity: Minor
                  Found in lib/aviator/openstack/identity/requests/v2/public/create_token.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 hashishify_values has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def hashishify_values
                      @hash.each do |key, value|
                        if @hash[key].kind_of? Hash
                          @hash[key] = Hashish.new(value)
                        elsif @hash[key].kind_of? Array
                  Severity: Minor
                  Found in lib/aviator/core/utils/hashish.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 headers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def headers
                        {}.tap do |h|
                          if self.anonymous?
                            # do nothing
                  
                  
                  Severity: Minor
                  Found in lib/aviator/openstack/common/requests/v0/public/base.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

                  Severity
                  Category
                  Status
                  Source
                  Language