lib/fog/google/shared.rb
Method build_excon_response
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
def build_excon_response(body, status = 200)
response = Excon::Response.new(:body => body, :status => status)
if body && body.key?("error")
msg = "Google Cloud did not return an error message"
- 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 initialize_google_client
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize_google_client(options)
# NOTE: loaded here to avoid requiring this as a core Fog dependency
begin
# TODO: google-api-client is in gemspec now, re-assess if this initialization logic is still needed
require "google/apis/monitoring_#{Fog::Google::Monitoring::GOOGLE_MONITORING_API_VERSION}"
Method validate_client_options
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def validate_client_options(options)
# Users can no longer provide their own clients due to rewrite of auth
# in https://github.com/google/google-api-ruby-client/ version 0.9.
if options[:google_client]
raise ArgumentError.new("Deprecated argument no longer works: google_client")
- 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"