rapid7/metasploit-framework

View on GitHub
lib/rex/proto/ldap.rb

Summary

Maintainability
D
2 days
Test Coverage

Method search has a Cognitive Complexity of 109 (exceeds 5 allowed). Consider refactoring.
Open

  def search(args = nil)
    args ||= {}

    # filtering, scoping, search base
    # filter: https://tools.ietf.org/html/rfc4511#section-4.5.1.7
Severity: Minor
Found in lib/rex/proto/ldap.rb - About 2 days 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 search has 130 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def search(args = nil)
    args ||= {}

    # filtering, scoping, search base
    # filter: https://tools.ietf.org/html/rfc4511#section-4.5.1.7
Severity: Major
Found in lib/rex/proto/ldap.rb - About 5 hrs to fix

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

        def read(length = nil, _opts = {})
          data = ''
          loop do
            chunk = super(length - data.length)
            if chunk.nil?
    Severity: Minor
    Found in lib/rex/proto/ldap.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

    There are no issues that match your filters.

    Category
    Status