ronin-rb/ronin

View on GitHub
lib/ronin/cli/commands/netcat.rb

Summary

Maintainability
D
2 days
Test Coverage

Method server_loop has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

        def server_loop
          finished    = Async::Notification.new
          endpoint    = async_endpoint
          stdin       = async_stdin
          clients     = []
Severity: Minor
Found in lib/ronin/cli/commands/netcat.rb - About 3 hrs 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 run has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

        def run(*args)
          if options[:hexdump]
            require 'hexdump'
            @hexdump = Hexdump::Hexdump.new
          end
Severity: Minor
Found in lib/ronin/cli/commands/netcat.rb - About 3 hrs 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

File netcat.rb has 258 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'ronin/cli/command'
require 'ronin/core/cli/logging'
require 'ronin/support/network/ssl'

require 'command_kit/options/verbose'
Severity: Minor
Found in lib/ronin/cli/commands/netcat.rb - About 2 hrs to fix

    Method client_loop has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

            def client_loop
              finished    = Async::Notification.new
              endpoint    = async_endpoint
              stdin       = async_stdin
              buffer_size = options[:buffer_size]
    Severity: Minor
    Found in lib/ronin/cli/commands/netcat.rb - About 2 hrs 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 run has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def run(*args)
              if options[:hexdump]
                require 'hexdump'
                @hexdump = Hexdump::Hexdump.new
              end
    Severity: Minor
    Found in lib/ronin/cli/commands/netcat.rb - About 2 hrs to fix

      Method server_loop has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def server_loop
                finished    = Async::Notification.new
                endpoint    = async_endpoint
                stdin       = async_stdin
                clients     = []
      Severity: Minor
      Found in lib/ronin/cli/commands/netcat.rb - About 1 hr to fix

        Method client_loop has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def client_loop
                  finished    = Async::Notification.new
                  endpoint    = async_endpoint
                  stdin       = async_stdin
                  buffer_size = options[:buffer_size]
        Severity: Minor
        Found in lib/ronin/cli/commands/netcat.rb - About 1 hr to fix

          There are no issues that match your filters.

          Category