crewmate/crewmate

View on GitHub
app/controllers/users_controller.rb

Summary

Maintainability
B
5 hrs
Test Coverage

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

  def create
    logout_keeping_session!
    @user = User.new(params[:user])

    @user.confirmed_user = ((@invitation && @invitation.email == @user.email) or
Severity: Minor
Found in app/controllers/users_controller.rb - About 2 hrs 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 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def create
    logout_keeping_session!
    @user = User.new(params[:user])

    @user.confirmed_user = ((@invitation && @invitation.email == @user.email) or
Severity: Minor
Found in app/controllers/users_controller.rb - About 1 hr to fix

    Method confirm_email has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def confirm_email
        logout_keeping_session!
        if @user
          if @user.is_login_token_valid? params[:token]
            if @user.is_active?
    Severity: Minor
    Found in app/controllers/users_controller.rb - About 55 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 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def new
        # Trying to accept a new account invitation, but you're already logged in
        if @invitation and logged_in?
          @invitation.invited_user = current_user
          @invitation.save
    Severity: Minor
    Found in app/controllers/users_controller.rb - About 45 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 signup_from_oauth has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def signup_from_oauth(profile, app_link)
          @user ||= User.new
          @user.first_name    = @user.first_name.presence || profile[:first_name]
          @user.last_name     = @user.last_name.presence  || profile[:last_name]
          if profile[:login]
    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 can_users_signup? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def can_users_signup?
          unless @invitation || signups_enabled?
            flash[:error] = t('users.new.no_public_signup')
            return redirect_to Teambox.config.community ? login_path : root_path
          end
    Severity: Minor
    Found in app/controllers/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

    There are no issues that match your filters.

    Category
    Status