amahi/platform

View on GitHub
plugins/010-users/app/controllers/users_controller.rb

Summary

Maintainability
B
5 hrs
Test Coverage

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

    def update
        sleep 2 if development?
        user = User.find params[:id]
        name = user.name
        if can_i_edit_details?(user)
Severity: Minor
Found in plugins/010-users/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 destroy has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def destroy
        sleep 2 if development?
        @user = User.find(params[:id])
        id = nil
        if @user && @user != current_user && !@user.admin?
Severity: Minor
Found in plugins/010-users/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 update_pin has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def update_pin
        sleep 2 if development?
        @user = User.find(params[:id])
        if(params[:user][:pin].blank? || params[:user][:pin_confirmation].blank?)
            errors = true
Severity: Minor
Found in plugins/010-users/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 update_password has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def update_password
        sleep 2 if development?
        @user = User.find(params[:id])
        if(params[:user][:password].blank? || params[:user][:password_confirmation].blank?)
            errors = true
Severity: Minor
Found in plugins/010-users/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 update_pubkey has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def update_pubkey
        sleep 2 if development?
        @user = User.find(params[:id])
        # sleep a little to see the spinner working well
        unless @user
Severity: Minor
Found in plugins/010-users/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

There are no issues that match your filters.

Category
Status