rapidftr/RapidFTR

View on GitHub

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
Severity: Minor
Found in app/controllers/media_controller.rb - About 25 mins to fix

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'
Severity: Minor
Found in app/helpers/application_helper.rb - About 25 mins to fix

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
Severity: Minor
Found in app/controllers/system_users_controller.rb - About 25 mins to fix

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
Severity: Minor
Found in app/controllers/sessions_controller.rb - About 25 mins to fix

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?
Severity: Minor
Found in app/controllers/children_controller.rb - About 25 mins to fix

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

Severity
Category
Status
Source
Language