SysMO-DB/seek

View on GitHub
app/controllers/users_controller.rb

Summary

Maintainability
C
1 day
Test Coverage

Method forgot_password has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

  def forgot_password    
    if request.get?
      # forgot_password.rhtml
    elsif request.post?      
      user = User.find_by_login(params[:login])
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 reset_password has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

  def reset_password
    user = User.find_by_reset_password_code(params[:reset_code] || "")

    respond_to do |format|
      if user
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 open_id_authentication has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def open_id_authentication(identity_url)
    # Pass optional :required and :optional keys to specify what sreg fields you want.
    # Be sure to yield registration, a third argument in the #authenticate_with_open_id block.
    authenticate_with_open_id(identity_url,        
        :required => [:email, :fullname,
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 open_id_authentication has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def open_id_authentication(identity_url)
    # Pass optional :required and :optional keys to specify what sreg fields you want.
    # Be sure to yield registration, a third argument in the #authenticate_with_open_id block.
    authenticate_with_open_id(identity_url,        
        :required => [:email, :fullname,
Severity: Minor
Found in app/controllers/users_controller.rb - About 1 hr to fix

    Method update has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def update    
        @user = User.find(params[:id])
        person=Person.find(params[:user][:person_id]) unless (params[:user][:person_id]).nil?
        @user.person=person if !person.nil?
    
    
    Severity: Minor
    Found in app/controllers/users_controller.rb - About 1 hr 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 activate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def activate
        self.current_user = params[:activation_code].blank? ? false : User.find_by_activation_code(params[:activation_code])
        if logged_in? && !current_user.active?
          current_user.activate      
          if (current_user.person.projects.empty? && User.count>1)
    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 set_openid has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def set_openid
        @user = User.find(params[:id])
        authenticate_with_open_id do |result, identity_url|
          if result.successful?
            @user.openid = identity_url
    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

    There are no issues that match your filters.

    Category
    Status