rapid7/metasploit-framework

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

Summary

Maintainability
B
6 hrs
Test Coverage

Method get_diagnostic_archive has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

  def get_diagnostic_archive(project)
    url = normalize_uri(target_uri.path, 'api', 'public', 'v1.0', 'groups', project, 'diagnostics')
    auth_response = digest_auth(url)
    # https://www.mongodb.com/docs/ops-manager/current/reference/api/diagnostics/get-project-diagnostic-archive/
    res = send_request_cgi(

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 initialize has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'MongoDB Ops Manager Diagnostic Archive Sensitive Information Retriever',

    Method get_diagnostic_archive has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def get_diagnostic_archive(project)
        url = normalize_uri(target_uri.path, 'api', 'public', 'v1.0', 'groups', project, 'diagnostics')
        auth_response = digest_auth(url)
        # https://www.mongodb.com/docs/ops-manager/current/reference/api/diagnostics/get-project-diagnostic-archive/
        res = send_request_cgi(

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

        def check
          url = normalize_uri(target_uri.path, 'api', 'public', 'v1.0')
          auth_response = digest_auth(url)
          # https://www.mongodb.com/docs/ops-manager/current/tutorial/update-om-with-latest-version-manifest-with-api/
          res = send_request_cgi(
      Severity: Minor
      Found in modules/auxiliary/gather/mongodb_ops_manager_diagnostic_archive_info.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