rapid7/metasploit-framework

View on GitHub
lib/rex/post/meterpreter/extensions/stdapi/sys/registry.rb

Summary

Maintainability
C
1 day
Test Coverage

Class Registry has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

class Registry

  class << self
    attr_accessor :client
  end
Severity: Minor
Found in lib/rex/post/meterpreter/extensions/stdapi/sys/registry.rb - About 2 hrs to fix

    File registry.rb has 269 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'rex/post/process'
    require 'rex/post/meterpreter/packet'
    require 'rex/post/meterpreter/client'
    require 'rex/post/meterpreter/extensions/stdapi/constants'
    require 'rex/post/meterpreter/extensions/stdapi/stdapi'
    Severity: Minor
    Found in lib/rex/post/meterpreter/extensions/stdapi/sys/registry.rb - About 2 hrs to fix

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

        def self.key2str(key)
          if (key == 'HKLM' or key == 'HKEY_LOCAL_MACHINE')
            return HKEY_LOCAL_MACHINE
          elsif (key == 'HKCU' or key == 'HKEY_CURRENT_USER')
            return HKEY_CURRENT_USER
      Severity: Minor
      Found in lib/rex/post/meterpreter/extensions/stdapi/sys/registry.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 set_value_direct has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def Registry.set_value_direct(root_key, base_key, name, type, data, perm = KEY_WRITE)
      Severity: Minor
      Found in lib/rex/post/meterpreter/extensions/stdapi/sys/registry.rb - About 45 mins to fix

        Avoid too many return statements within this method.
        Open

              return HKEY_CURRENT_CONFIG
        Severity: Major
        Found in lib/rex/post/meterpreter/extensions/stdapi/sys/registry.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                return HKEY_DYN_DATA
          Severity: Major
          Found in lib/rex/post/meterpreter/extensions/stdapi/sys/registry.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                  return HKEY_PERFORMANCE_DATA
            Severity: Major
            Found in lib/rex/post/meterpreter/extensions/stdapi/sys/registry.rb - About 30 mins to fix

              There are no issues that match your filters.

              Category
              Status