fiedl/your_platform

View on GitHub

Showing 213 of 251 total issues

Method create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    if params[:invalid_email].present?
      email_field = ProfileFields::Email.where(value: params[:invalid_email]).first
      if email_field
        email_field.needs_review!
Severity: Minor
Found in app/controllers/issues_controller.rb - About 35 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 accept_terms_of_use has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def accept_terms_of_use
    if current_user && current_user.account && (not read_only_mode?) && (not controller_name.in?(['terms_of_use', 'sessions', 'passwords', 'user_accounts', 'attachments', 'errors'])) && (not TermsOfUseController.accepted?(current_user))
      if request.url.include?('redirect_after')
        redirect_after = root_path
      else
Severity: Minor
Found in app/controllers/concerns/accept_terms_of_use.rb - About 35 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 new_value has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def new_value
    value = params[:rails_settings_scoped_settings].try(:[], :value)
    value ||= params['rails_settings/settings'].try(:[], :value)
    value ||= params[:setting].try(:[], :value)
    value ||= params[:value]
Severity: Minor
Found in app/controllers/settings_controller.rb - About 35 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_guest_user_from_form_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def create_guest_user_from_form_data
    if (name = params[:guest_user_name]).present? || (email = params[:guest_user_email] || params[:email]).present?
      unless current_user
        cookies[:guest_user_name] = name
        cookies[:guest_user_email] = email
Severity: Minor
Found in app/controllers/concerns/current_user.rb - About 35 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 current_logo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def current_logo(key = nil)
    logos = if current_home_page
      Attachment.where(parent_type: 'Page', parent_id: [current_home_page.id] + current_home_page.child_pages.pluck(:id)).logos
    else
      Attachment.none
Severity: Minor
Found in app/controllers/concerns/current_layout.rb - About 35 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 find_user has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def find_user
    if not handle_mystery_user
      @user = User.find(params[:id]) if params[:id].present?
      @user ||= User.find_by_alias(params[:alias]) if params[:alias].present?
      @user ||= User.new
Severity: Minor
Found in app/controllers/users_controller.rb - About 35 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 permitted_group_attributes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def permitted_group_attributes
    permitted_keys = []
    permitted_keys += [:name, :extensive_name] if can? :rename, @group
    permitted_keys += [:token] if can? :change_token, @group
    permitted_keys += [:internal_token] if can? :change_internal_token, @group
Severity: Minor
Found in app/controllers/groups_controller.rb - About 35 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 update_locale_cookie has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def update_locale_cookie
    cookies[:locale] = secure_locale_param if params[:locale].present?
    cookies[:locale] = nil if params[:locale] and params[:locale] == ""
    cookies[:locale] = nil if cookies[:locale] == ""
  end
Severity: Minor
Found in app/controllers/concerns/current_locale.rb - About 35 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 destroy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def destroy
    authorize! :update, parent

    link = object.links_as_child.find_by(ancestor_id: parent.id, ancestor_type: parent.class.base_class.name)
    link.destroy!
Severity: Minor
Found in app/controllers/structureables/sub_entries_controller.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    authorize! :add_group_member_manually, group
    raise ActionController::ParameterMissing, 'No user title given' unless membership_params[:user_title].present?
    raise ActionController::ParameterMissing, 'User not found' unless user

Severity: Minor
Found in app/controllers/memberships/from_members_index_controller.rb - About 35 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

Avoid too many return statements within this method.
Open

    return 'full_member' if full_member?
Severity: Major
Found in app/models/role.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

        return ''
    Severity: Major
    Found in app/models/role.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

            return false
      Severity: Major
      Found in app/models/post_delivery.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

            return 'former_member' if former_member?
        Severity: Major
        Found in app/models/role.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

              return 'deceased_member' if deceased_member?
          Severity: Major
          Found in app/models/role.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                return []
            Severity: Major
            Found in app/models/role.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                  return t :all_events if @all
              Severity: Major
              Found in app/helpers/events_helper.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                    return 'guest' if guest?
                Severity: Major
                Found in app/models/role.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                      return ['global_officer', 'user', 'public'] if global_officer?
                  Severity: Major
                  Found in app/models/role.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                        return 'member' if member?
                    Severity: Major
                    Found in app/models/role.rb - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language