Method create
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def create
attr = params[:media_sets] || params[:media_set]
filter = params[:filter]
is_saved = true
- 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 individual_contexts
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def individual_contexts
unless check_for_old_id_and_in_case_redirect_to :inheritable_contexts_media_set_path
check_and_initialize_for_view # sets @media_set, @individual_contexts
if (params[:context_id]).blank?
- 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 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
attr = params[:media_sets] || params[:media_set]
filter = params[:filter]
is_saved = true
Method check_and_initialize_for_view
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check_and_initialize_for_view
# here, everything is initialized that we need everywhere (Tabs!)
@media_set = find_media_resource
raise UserUnauthorizedError unless current_user.login.present? || current_user.authorized?(:view, @media_set)
raise UserForbiddenError unless current_user.authorized?(:view,@media_set)
Method check_and_initialize_for_view
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check_and_initialize_for_view
# here, everything is initialized that we need everywhere (Tabs!)
@media_set = find_media_resource
raise UserUnauthorizedError unless current_user.login.present? || current_user.authorized?(:view, @media_set)
raise UserForbiddenError unless current_user.authorized?(:view,@media_set)
- 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"