Showing 85 of 110 total issues
Method find_photo_attachment
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def find_photo_attachment
redirect_to(:photo_id => @model.current_photo_key, :ts => @model.last_updated_at) && return if
params[:photo_id].to_s.empty? && @model.current_photo_key.present?
begin
- 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 link_with_confirm
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def link_with_confirm(link_to, anchor, link_options = {})
msg = nil
confirm_message = t('messages.confirmation_message')
if /children/.match(controller.controller_name) && /edit|new/.match(controller.action_name)
msg = confirm_message % 'Child Record'
- 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_user
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def load_user
@user = SystemUsers.get('org.couchdb.user:' + params[:id])
if @user.nil? || params[:system_users].nil? ? false : @user.name != params[:system_users][:name]
flash[:error] = t('user.messages.not_found')
redirect_to(:action => :edit) && return
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def create
@login = Login.new(params)
@session = @login.authenticate_user
unless @session
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def create
authorize! :create, Child
params[:child] = JSON.parse(params[:child]) if params[:child].is_a?(String)
create_or_update_child(params[:child])
params[:child][:photo] = params[:current_photo_key] unless params[:current_photo_key].nil?
- 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"