rapid7/metasploit-framework

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

Summary

Maintainability
C
7 hrs
Test Coverage

Method packages has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

  def packages
    res = send_req('cgi-bin/bfenterprise/BESMirrorRequest.exe')
    return unless res && res.code == 200

    print_status('Packages')
Severity: Minor
Found in modules/auxiliary/gather/ibm_bigfix_sites_packages_enum.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 initialize has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def initialize(info = {})
    super(update_info(info,
      'Name'  => 'IBM BigFix Relay Server Sites and Package Enum',
      'Description' => %q{
        This module retrieves masthead, site, and available package information
Severity: Minor
Found in modules/auxiliary/gather/ibm_bigfix_sites_packages_enum.rb - About 1 hr to fix

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

      def download
        print_status('Downloading packages')
        @files.each do |action, val|
          next if val.empty?
          res = send_req("bfmirror/downloads/#{action}/0")
    Severity: Minor
    Found in modules/auxiliary/gather/ibm_bigfix_sites_packages_enum.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 packages has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def packages
        res = send_req('cgi-bin/bfenterprise/BESMirrorRequest.exe')
        return unless res && res.code == 200
    
        print_status('Packages')
    Severity: Minor
    Found in modules/auxiliary/gather/ibm_bigfix_sites_packages_enum.rb - About 1 hr to fix

      Method run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def run
          masthead if datastore['SHOW_MASTHEAD']
          sites if datastore['SHOW_SITES']
          packages if datastore['SHOW_PACKAGES'] || datastore['DOWNLOAD']
          download if datastore['DOWNLOAD'] && @files != {}
      Severity: Minor
      Found in modules/auxiliary/gather/ibm_bigfix_sites_packages_enum.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