Method send_request
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def send_request(method, path, params, &block)
begin
@error = nil
@response = handle.run_request(method.to_sym, api_path(path), nil, nil) do |request|
request.headers[:content_type] = CONTENT_TYPE
- 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 handle
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def handle
ssl_options = @connection_options[:ssl]
Faraday.new(:url => url, :ssl => ssl_options) do |faraday|
faraday.request(:url_encoded) # form-encode POST params
faraday.options.open_timeout = @connection_options[:open_timeout] if @connection_options[:open_timeout]
- 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 check_response
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_response
if response.status == 404
message = json_response["error"].kind_of?(String) ? json_response["error"] : json_response.dig("error", "message")
raise ManageIQ::API::Client::ResourceNotFound, message
elsif response.status >= 400
- 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 api_path
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def api_path(path)
if path.to_s.start_with?(url.to_s)
path.to_s
elsif path.to_s.blank?
URI.join(url, API_PREFIX).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"