Showing 4 of 8 total issues
Method accept_or_reject_invitation
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def accept_or_reject_invitation(decision)
if !extract_arguments_from_params(:from_user)
render_error :resource_not_found and return
end
invite = Invite.pending_invite @from_user, @me
- 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 public_content
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def public_content(user1_name = "The first gladiator", user2_name = "The second gladiator")
user1_id = arena.user1_id
user2_id = arena.user2_id
content = posts.map { |post|
{
- 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 edit_title
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def edit_title
unless did_extract_arguments_from_params
render_error :resource_not_found and return
end
arena = @conversation.arena
- 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 extract_arguments_from_params
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def extract_arguments_from_params(*param_keys)
for key in param_keys
if params[key].nil?
return false
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"