rapid7/metasploit-framework

View on GitHub
lib/msf/core/post/windows/user_profiles.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Method load_missing_hives has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def load_missing_hives
    hives=[]
    read_profile_list().each do |hive|
      hive['OURS']=false
      if hive['LOADED']== false
Severity: Minor
Found in lib/msf/core/post/windows/user_profiles.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 read_profile_list has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def read_profile_list(user_accounts_only: true)
    hives=[]
    registry_enumkeys('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList').each do |profkey|
      if user_accounts_only
        next unless profkey.starts_with?('S-1-5-21')
Severity: Minor
Found in lib/msf/core/post/windows/user_profiles.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 loaded_hives has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def loaded_hives
    hives=[]
    registry_enumkeys('HKU').each do |k|
      next unless k.starts_with?('S-1-')
      next if k.include? "_Classes"
Severity: Minor
Found in lib/msf/core/post/windows/user_profiles.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