CartoDB/cartodb20

View on GitHub
app/controllers/admin/organization_users_controller.rb

Summary

Maintainability
D
2 days
Test Coverage

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

  def update
    valid_password_confirmation
    session[:show_dashboard_details_flash] = params[:show_dashboard_details_flash].present?
    session[:show_account_settings_flash] = params[:show_account_settings_flash].present?

Severity: Minor
Found in app/controllers/admin/organization_users_controller.rb - About 7 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 a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    @user = ::User.new

    # Validation is done on params to allow checking the change of the value.
    # The error is deferred to display values in the form in the error scenario.
Severity: Minor
Found in app/controllers/admin/organization_users_controller.rb - About 3 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 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def create
    @user = ::User.new

    # Validation is done on params to allow checking the change of the value.
    # The error is deferred to display values in the form in the error scenario.
Severity: Major
Found in app/controllers/admin/organization_users_controller.rb - About 2 hrs to fix

    Method update has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def update
        valid_password_confirmation
        session[:show_dashboard_details_flash] = params[:show_dashboard_details_flash].present?
        session[:show_account_settings_flash] = params[:show_account_settings_flash].present?
    
    
    Severity: Major
    Found in app/controllers/admin/organization_users_controller.rb - About 2 hrs to fix

      Method destroy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def destroy
          valid_password_confirmation
          raise "Can't delete user. Has shared entities" if @user.has_shared_entities?
      
          @user.destroy
      Severity: Minor
      Found in app/controllers/admin/organization_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