rapid7/metasploit-framework

View on GitHub
lib/msf/core/module/module_info.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Method merge_check_key has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def merge_check_key(info, name, val)
    if (self.respond_to?("merge_info_#{name.downcase}", true))
      self.send("merge_info_#{name.downcase}", info, val)
    else
      # If the info hash already has an entry for this name
Severity: Minor
Found in lib/msf/core/module/module_info.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 merge_check_key has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def merge_check_key(info, name, val)
    if (self.respond_to?("merge_info_#{name.downcase}", true))
      self.send("merge_info_#{name.downcase}", info, val)
    else
      # If the info hash already has an entry for this name
Severity: Minor
Found in lib/msf/core/module/module_info.rb - About 1 hr to fix

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

      def merge_info_options(info, val, advanced = false, evasion = false)
    
        key_name = ((advanced) ? 'Advanced' : (evasion) ? 'Evasion' : '') + 'Options'
    
        new_cont = Msf::OptionContainer.new
    Severity: Minor
    Found in lib/msf/core/module/module_info.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 merge_info_string has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def merge_info_string(info, key, val, delim = ', ', inverse = false)
    Severity: Minor
    Found in lib/msf/core/module/module_info.rb - About 35 mins to fix

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

        def info_fixups
          # Each reference should be an array consisting of two elements
          refs = module_info['References']
          if(refs and not refs.empty?)
            refs.each_index do |i|
      Severity: Minor
      Found in lib/msf/core/module/module_info.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

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

        def update_info(info, opts)
          opts.each_pair do |name, val|
            # If the supplied option name is one of the ones that we should
            # override by default
            if UpdateableOptions.include?(name)
      Severity: Minor
      Found in lib/msf/core/module/module_info.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