Class AuthSourceLdap
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class AuthSourceLdap < AuthSource
SERVER_TYPES = { :free_ipa => 'FreeIPA', :active_directory => 'Active Directory',
:posix => 'POSIX'}
extend FriendlyId
Method authenticate
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def authenticate(login = account, password = account_password)
return if login.blank? || password.blank?
logger.debug "LDAP auth with user #{login} against #{self}"
- Read upRead up
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 attributes_values
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def attributes_values(entry)
Hash[required_ldap_attributes.merge(optional_ldap_attributes).map do |name, value|
next if value.blank? || (entry[value].blank? && optional_ldap_attributes.key?(name))
if name.eql? :avatar
[:avatar_hash, store_avatar(entry[value].first)]
- Read upRead up
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 store_avatar
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def store_avatar(avatar)
unless avatar.instance_of?(Net::BER::BerIdentifiedString)
avatar = avatar.to_utf8
end
avatar_hash = Digest::SHA1.hexdigest(avatar)
- Read upRead up
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 set_defaults
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_defaults
self.port ||= DEFAULT_PORTS[:ldap]
self.attr_login ||= 'uid'
self.attr_firstname ||= 'givenName'
self.attr_lastname ||= 'sn'
- Read upRead up
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"