Showing 5 of 5 total issues
Method handle_error
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def handle_error(error)
error_to_raise = nil
begin
error_to_raise = Error.new(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 track_recommendation_click
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def track_recommendation_click source_id, destination_id, user_id, klass, options = {}
Method configure_request
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def configure_request(url, request: nil, params: nil, headers: nil, body: nil)
if request
request.url "/#{url}.json"
request.params.merge!(params) if params
request.headers['Content-Type'] = 'application/json'
- 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 user_recommendations
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def user_recommendations user_id, options = {}
options = options.reverse_merge(default_options)
klass = options.delete(:object_type) || options.delete(:class)
if klass.present?
- 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 recommendations_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def recommendations_for item, options = {}
options = options.reverse_merge(default_options)
klass = item.is_a?(Hash) ? item.delete(:class) : item.class.to_s.downcase
object_id = item.is_a?(Hash) ? item.delete(:object_id) : item.id
- 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"