rapid7/metasploit-framework

View on GitHub
modules/auxiliary/gather/memcached_extractor.rb

Summary

Maintainability
C
7 hrs
Test Coverage

Method run_host has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def run_host(ip)
    peer = "#{ip}:#{rport}"
    vprint_status("Connecting to memcached server...")
    begin
      connect
Severity: Minor
Found in modules/auxiliary/gather/memcached_extractor.rb - About 1 hr to fix

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

      def run_host(ip)
        peer = "#{ip}:#{rport}"
        vprint_status("Connecting to memcached server...")
        begin
          connect
    Severity: Minor
    Found in modules/auxiliary/gather/memcached_extractor.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 enumerate_keys has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

      def enumerate_keys
        keys = []
        enumerate_slab_ids.each do |sid|
          sock.send("stats cachedump #{sid} #{max_keys}\r\n", 0)
          loop do
    Severity: Minor
    Found in modules/auxiliary/gather/memcached_extractor.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 enumerate_keys_lru has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def enumerate_keys_lru
        keys = []
        sock.send("lru_crawler metadump all\r\n", 0)
        loop do
          data = sock.recv(4096)
    Severity: Minor
    Found in modules/auxiliary/gather/memcached_extractor.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 data_for_keys has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def data_for_keys(keys = [])
        all_data = {}
        keys.each do |key|
          sock.send("get #{key}\r\n", 0)
          data = []
    Severity: Minor
    Found in modules/auxiliary/gather/memcached_extractor.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

    Method enumerate_slab_ids has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def enumerate_slab_ids
        sock.send("stats slabs\r\n", 0)
        slab_ids = []
        loop do
          data = sock.recv(4096)
    Severity: Minor
    Found in modules/auxiliary/gather/memcached_extractor.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