rapid7/metasploit-framework

View on GitHub
lib/rex/proto/dns/server.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Method initialize has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def initialize(lhost = '0.0.0.0', lport = 53, udp = true, tcp = false, start_cache = true, res = nil, comm = nil, ctx = {}, dblock = nil, sblock = nil)
Severity: Major
Found in lib/rex/proto/dns/server.rb - About 1 hr to fix

    Method stop has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def stop(flush_cache = false)
        ensure_close = [self.udp_sock, self.tcp_sock].compact
        begin
          self.listener_thread.kill if self.listener_thread.respond_to?(:kill)
          self.listener_thread = nil
    Severity: Minor
    Found in lib/rex/proto/dns/server.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 default_dispatch_request has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def default_dispatch_request(cli,data)
        return if data.strip.empty?
        req = Packet.encode_drb(data)
        forward = req.dup
        # Find cached items, remove request from forwarded packet
    Severity: Minor
    Found in lib/rex/proto/dns/server.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

    There are no issues that match your filters.

    Category
    Status