Method db_connect_postgresql
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def self.db_connect_postgresql(framework, cli_opts)
info = db_parse_db_uri_postgresql(cli_opts[:url])
opts = { 'adapter' => 'postgresql' }
opts['username'] = info[:user] if (info[:user])
- 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 db_connect_from_config
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def self.db_connect_from_config(framework, path = nil)
begin
conf = Msf::Config.load(path)
rescue StandardError => e
wlog("Failed to load configuration: #{e}")
- 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 db_connect
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.db_connect(framework, opts = {})
unless framework.db.driver
return { error: 'No database driver installed.'}
end
- 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 db_connect_postgresql
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.db_connect_postgresql(framework, cli_opts)
info = db_parse_db_uri_postgresql(cli_opts[:url])
opts = { 'adapter' => 'postgresql' }
opts['username'] = info[:user] if (info[:user])
Method db_parse_db_uri_postgresql
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.db_parse_db_uri_postgresql(path)
res = {}
if path
auth, dest = path.split('@')
(dest = auth and auth = nil) if not dest
- 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 as_connection_options
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.as_connection_options(conf_options)
opts = {}
https_opts = {}
if conf_options
opts[:url] = conf_options[:url] if conf_options[:url]
- 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 db_connect
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.db_connect(framework, opts = {})
unless framework.db.driver
return { error: 'No database driver installed.'}
end
Method db_disconnect
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.db_disconnect(framework)
result = { old_data_service_name: framework.db.name }
unless framework.db.driver
result[:error] = 'No database driver installed.'
return result
- 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"