gitlabhq/gitlabhq

View on GitHub
app/controllers/application_controller.rb

Summary

Maintainability
D
2 days
Test Coverage

Class ApplicationController has 67 methods (exceeds 20 allowed). Consider refactoring.
Open

class ApplicationController < ActionController::Base
  include Gitlab::GonHelper
  include Gitlab::NoCacheHeaders
  include GitlabRoutingHelper
  include PageLayoutHelper
Severity: Major
Found in app/controllers/application_controller.rb - About 1 day to fix

    File application_controller.rb has 444 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'gon'
    require 'fogbugz'
    
    class ApplicationController < ActionController::Base
      include Gitlab::GonHelper
    Severity: Minor
    Found in app/controllers/application_controller.rb - About 6 hrs to fix

      Method enforce_terms! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def enforce_terms!
          return unless current_user
          return if current_user.terms_accepted?
      
          message = _("Please accept the Terms of Service before continuing.")
      Severity: Minor
      Found in app/controllers/application_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 ldap_security_check has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def ldap_security_check
          if current_user && current_user.requires_ldap_check?
            return unless current_user.try_obtain_ldap_lease
      
            unless Gitlab::Auth::LDAP::Access.allowed?(current_user)
      Severity: Minor
      Found in app/controllers/application_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 required_signup_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def required_signup_info
          return unless current_user
          return unless current_user.role_required?
          return unless experiment_enabled?(:signup_flow)
      
      
      Severity: Minor
      Found in app/controllers/application_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