Showing 10 of 12 total issues
Method authenticate_v3
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def authenticate_v3
raise(AuthenticationError, "auth_url missing") unless options[:auth_url]
raise(AuthenticationError, "username in combination with domain/domain_id is deprecated, please use user_domain/user_domain_id instead") if options[:username] && (options[:domain] || options[:domain_id]) && !options[:user_domain] && !options[:user_domain_id]
auth = { "auth" => { "identity" => {} } }
- 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 SwiftClient
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class SwiftClient
class AuthenticationError < StandardError; end
class OptionError < StandardError; end
class EmptyNameError < StandardError; end
class TempUrlKeyMissing < StandardError; end
File swift_client.rb
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "swift_client/version"
require "swift_client/null_cache"
require "httparty"
require "mime-types"
Method put_object
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def put_object(object_name, data_or_io, container_name, headers = {}, options = {})
raise(EmptyNameError) if object_name.empty? || container_name.empty?
mime_type = MIME::Types.of(object_name).first
- 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 authenticate_v3
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def authenticate_v3
raise(AuthenticationError, "auth_url missing") unless options[:auth_url]
raise(AuthenticationError, "username in combination with domain/domain_id is deprecated, please use user_domain/user_domain_id instead") if options[:username] && (options[:domain] || options[:domain_id]) && !options[:user_domain] && !options[:user_domain_id]
auth = { "auth" => { "identity" => {} } }
Method authenticate_v2
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def authenticate_v2
[:auth_url, :storage_url].each do |key|
raise(AuthenticationError, "#{key} missing") unless options[key]
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 request
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def request(method, path, opts = {}, &block)
headers = (opts[:headers] || {}).dup
headers["X-Auth-Token"] = auth_token
headers["Accept"] ||= "application/json" unless opts.delete(:json) == false
- 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 paginate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def paginate(method, *args, query, options)
return enum_for(:paginate, method, *args, query, options) unless block_given?
marker = nil
- 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 put_object
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def put_object(object_name, data_or_io, container_name, headers = {}, options = {})
Method authenticate_v1
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def authenticate_v1
[:auth_url, :username, :api_key].each do |key|
raise(AuthenticationError, "#{key} missing") unless options[key]
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"