Class SpacesController
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class SpacesController < InheritedResources::Base
include Mconf::ApprovalControllerModule # for approve, disapprove
include Mconf::DisableControllerModule # for enable, disable
include Mconf::SelectControllerModule # select
Method handle_access_denied
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def handle_access_denied(exception)
# anonymous users are required to sign in
if !user_signed_in?
redirect_to login_path
- 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 load_spaces_index
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def load_spaces_index
spaces = Space.where(approved: true)
@user_spaces = user_signed_in? ? current_user.spaces : Space.none
words = params[:q].try(:split, /\s+/)
- 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 create
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create
if @space.save
respond_with @space do |format|
# the user that created the space is always an admin
- 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 leave
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def leave
permission = @space.permissions.find_by_user_id(current_user)
if permission
permission.destroy
- 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"