vicvega/chaltron

View on GitHub
lib/chaltron/ldap/connection.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Method find_users has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

        def find_users(args)
          return [] if args.empty?
          limit = args.delete(:limit)
          fields = args.keys

Severity: Minor
Found in lib/chaltron/ldap/connection.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 custom_tls_options has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

        def custom_tls_options
          return {} unless options['tls_options']

          # Dup so we don't overwrite the original value
          custom_options = options['tls_options'].dup.delete_if { |_, value| value.nil? || value.blank? }
Severity: Minor
Found in lib/chaltron/ldap/connection.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 tls_options has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def tls_options
          return @tls_options if defined?(@tls_options)

          method = translate_method
          return unless method
Severity: Minor
Found in lib/chaltron/ldap/connection.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_search has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def ldap_search(*args)
          results = ldap.search(*args)
          if results.nil?
            response = ldap.get_operation_result
            unless response.code.zero?
Severity: Minor
Found in lib/chaltron/ldap/connection.rb - About 35 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