rapid7/metasploit-framework

View on GitHub
lib/msf/core/post/linux/f5_mcp.rb

Summary

Maintainability
B
6 hrs
Test Coverage

Method mcp_parse has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def mcp_parse(stream)
          # Reminder: this has to be an array, not a hash, because there are
          # often duplicate entries (like multiple userdb_entry results when a
          # query is performed).
          result = []
Severity: Major
Found in lib/msf/core/post/linux/f5_mcp.rb - About 2 hrs to fix

    Method mcp_build has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

            def mcp_build(tag, type, data)
              if @tags_by_name[tag].nil?
                raise "Invalid mcp tag: #{tag}"
              end
              if @tags_by_name[type].nil?
    Severity: Minor
    Found in lib/msf/core/post/linux/f5_mcp.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 mcp_build has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def mcp_build(tag, type, data)
              if @tags_by_name[tag].nil?
                raise "Invalid mcp tag: #{tag}"
              end
              if @tags_by_name[type].nil?
    Severity: Minor
    Found in lib/msf/core/post/linux/f5_mcp.rb - About 1 hr to fix

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

              def mcp_parse(stream)
                # Reminder: this has to be an array, not a hash, because there are
                # often duplicate entries (like multiple userdb_entry results when a
                # query is performed).
                result = []
      Severity: Minor
      Found in lib/msf/core/post/linux/f5_mcp.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 mcp_send_recv has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              def mcp_send_recv(messages)
                # Attach headers to each message and combine them
                message = messages.map do |m|
                  [m.length, 0, 0, 0, m].pack('NNNNa*')
                end.join('')
      Severity: Minor
      Found in lib/msf/core/post/linux/f5_mcp.rb - About 25 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