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]
- Read upRead up
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."
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)]
- Read upRead up
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={}, ¶ms)
if options[:api_version].nil? && @default_options[:api_version]
options[:api_version] = @default_options[:api_version]
end
- Read upRead up
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)
- Read upRead up
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)
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?
- Read upRead up
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 = []
- Read upRead up
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 = []
- Read upRead up
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
- Read upRead up
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
- Read upRead up
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={}, ¶ms)
if options[:api_version].nil? && @default_options[:api_version]
options[:api_version] = @default_options[:api_version]
end
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)]
Avoid deeply nested control flow statements. Open
raise Aviator::Service::MissingServiceEndpointError.new(service.to_s, request_name) unless service_specs.length > 0
Avoid deeply nested control flow statements. Open
raise MultipleServiceApisError.new(service, service_specs, request_name) unless service_specs.length <= 1
Avoid deeply nested control flow statements. Open
version ? version[1].to_sym : :v1
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)
Method body
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def body
p = if params[:tokenId]
{
:auth => {
:token => {
- Read upRead up
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
- Read upRead up
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
- Read upRead up
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"