gitlabhq/gitlabhq

View on GitHub
lib/gitlab/auth/o_auth/user.rb

Summary

Maintainability
B
6 hrs
Test Coverage

Class User has 32 methods (exceeds 20 allowed). Consider refactoring.
Open

      class User
        SignupDisabledError = Class.new(StandardError)
        SigninDisabledForProviderError = Class.new(StandardError)

        attr_accessor :auth_hash, :gl_user
Severity: Minor
Found in lib/gitlab/auth/o_auth/user.rb - About 4 hrs to fix

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

            def update_profile
              clear_user_synced_attributes_metadata
    
              return unless sync_profile_from_provider? || creating_linked_ldap_user?
    
    
    Severity: Minor
    Found in lib/gitlab/auth/o_auth/user.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 save has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def save(provider = 'OAuth')
              raise SigninDisabledForProviderError if oauth_provider_disabled?
              raise SignupDisabledError unless gl_user
    
              block_after_save = needs_blocking?
    Severity: Minor
    Found in lib/gitlab/auth/o_auth/user.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 find_user has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

            def find_user
              user = find_by_uid_and_provider
    
              user ||= find_or_build_ldap_user if auto_link_ldap_user?
              user ||= build_new_user if signup_enabled?
    Severity: Minor
    Found in lib/gitlab/auth/o_auth/user.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