Method load_module
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
def load_module(parent_path, type, module_reference_name, options = {})
options.assert_valid_keys(:count_by_type, :force, :recalculate_by_type, :reload, :cached_metadata)
force = options[:force] || false
reload = options[:reload] || false
File base.rb
has 321 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'msf/core/constants'
# Responsible for loading modules for {Msf::ModuleManager}.
#
# @abstract Subclass and override {#each_module_reference_name}, {#loadable?}, {#module_path}, and
# {#read_module_content}.
Method load_module
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def load_module(parent_path, type, module_reference_name, options = {})
options.assert_valid_keys(:count_by_type, :force, :recalculate_by_type, :reload, :cached_metadata)
force = options[:force] || false
reload = options[:reload] || false
- 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
Class Base
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Msf::Modules::Loader::Base
#
# CONSTANTS
#
Method reload_module
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def reload_module(original_metasploit_class_or_instance)
if original_metasploit_class_or_instance.is_a? Msf::Module
original_metasploit_instance = original_metasploit_class_or_instance
original_metasploit_class = original_metasploit_class_or_instance.class
else
- 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 reload_module
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def reload_module(original_metasploit_class_or_instance)
if original_metasploit_class_or_instance.is_a? Msf::Module
original_metasploit_instance = original_metasploit_class_or_instance
original_metasploit_class = original_metasploit_class_or_instance.class
else
Method restore_namespace_module
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def restore_namespace_module(parent_module, relative_name, namespace_module)
if parent_module
# If there is a current module with relative_name
if parent_module.const_defined?(relative_name)
# if the current value isn't the value to be restored.
- 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 namespace_module_transaction
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def namespace_module_transaction(module_full_name, options={}, &block)
options.assert_valid_keys(:reload)
reload = options[:reload] || false
namespace_module_names = self.namespace_module_names(module_full_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
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return true
Avoid too many return
statements within this method. Open
return false unless loaded