Method the_messy_before_filter
has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open
def the_messy_before_filter
if [:edit_multiple, :update_multiple, :remove_multiple].include? request[:action].to_sym
begin
if !params[:media_set_id].blank?
action = case request[:action].to_sym
- 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 the_messy_before_filter
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
def the_messy_before_filter
if [:edit_multiple, :update_multiple, :remove_multiple].include? request[:action].to_sym
begin
if !params[:media_set_id].blank?
action = case request[:action].to_sym
Method update_multiple
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def update_multiple
ActiveRecord::Base.transaction do
@media_entries.each do |media_entry|
meta_data_attributes= params[:resource].try(:[],'meta_data_attributes')
to_be_updated_meta_data_attributes=
- 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 check_and_initialize_for_view
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check_and_initialize_for_view
@media_entry = find_media_resource
raise "Wrong type" unless @media_entry.is_a? MediaEntry
raise UserUnauthorizedError if (logged_in? && current_user.login.nil?) && @media_entry.view == false
raise UserForbiddenError unless current_user.try(:authorized?, :view, @media_entry) || @media_entry.view == 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"