CartoDB/cartodb20

View on GitHub
app/controllers/carto/api/users_controller.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Method update_me has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def update_me
        user = current_viewer
        attributes = params[:user]

        if attributes.present?
Severity: Minor
Found in app/controllers/carto/api/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 me has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def me
        carto_viewer = current_viewer.present? ? Carto::User.find(current_viewer.id) : nil

        config = {
          user_frontend_version: CartoDB::Application.frontend_version
Severity: Minor
Found in app/controllers/carto/api/users_controller.rb - About 1 hr to fix

    Method render_auth_users_data has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def render_auth_users_data(user, referrer, subdomain, referrer_organization_username=nil)
            organization_name = nil
    
            # It doesn't have a organization username component. We assume it's not a organization referer
            if referrer_organization_username.nil?
    Severity: Minor
    Found in app/controllers/carto/api/users_controller.rb - About 1 hr to fix

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

            def render_auth_users_data(user, referrer, subdomain, referrer_organization_username=nil)
              organization_name = nil
      
              # It doesn't have a organization username component. We assume it's not a organization referer
              if referrer_organization_username.nil?
      Severity: Minor
      Found in app/controllers/carto/api/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 delete_me has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def delete_me
              user = current_viewer
      
              deletion_password_confirmation = params[:deletion_password_confirmation]
      
      
      Severity: Minor
      Found in app/controllers/carto/api/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