Showing 8 of 8 total issues
Method request
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def request(method, path, options)
response = connection.send(method) do |request|
case method
when :get, :delete
request.url(path, options)
- 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 connection
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def connection
options = {
:headers => {
'Accept' => "application/#{format}; charset=utf-8"
}
Method with_api_methods
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.with_api_methods(map)
map.each do |_, method_description|
api_module = method_description[:api_module]
api_scope = method_description[:scope]
is_legacy = (method_description[:legacy].nil? ? true : method_description[:legacy])
- 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 with_action
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.with_action(method, api_module, api_scope, path_prefix = nil, method_prefix = nil, is_legacy = true)
Method get_method_name_and_params
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.get_method_name_and_params(method, api_module, api_scope, is_nested = false, method_prefix = nil)
Method connection
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def connection
options = {
:headers => {
'Accept' => "application/#{format}; charset=utf-8"
}
- 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
Avoid too many return
statements within this method. Open
return "#{method}_#{base}", "#{params_base}id, options = {})", has_options
Avoid too many return
statements within this method. Open
return "#{method}_#{base}", "#{params_base}id)", has_options