Method module_info_by_path_from_database!
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def module_info_by_path_from_database!(allowed_paths=[""])
self.module_info_by_path = {}
allowed_paths = allowed_paths.map{|x| x + "/"}
- Read upRead up
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 module_info_by_path_from_database!
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def module_info_by_path_from_database!(allowed_paths=[""])
self.module_info_by_path = {}
allowed_paths = allowed_paths.map{|x| x + "/"}
Method try_load_module
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def try_load_module(parent_path, reference_name, type, cached_metadata: nil)
loaded = false
# XXX borked
loaders.each do |loader|
next unless cached_metadata || loader.loadable_module?(parent_path, type, reference_name)
- Read upRead up
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 load_cached_module
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def load_cached_module(type, reference_name, cache_type: Msf::ModuleManager::Cache::MEMORY)
case cache_type
when Msf::ModuleManager::Cache::FILESYSTEM
cached_metadata = Msf::Modules::Metadata::Cache.instance.get_module_reference(type: type, reference_name: reference_name)
return false unless cached_metadata
- Read upRead up
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"