Method cmd_jobs
has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring. Open
def cmd_jobs(*args)
# Make the default behavior listing all jobs if there were no options
# or the only option is the verbose flag
args.unshift("-l") if args.empty? || args == ["-v"]
- 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 cmd_jobs
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cmd_jobs(*args)
# Make the default behavior listing all jobs if there were no options
# or the only option is the verbose flag
args.unshift("-l") if args.empty? || args == ["-v"]
File jobs.rb
has 335 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Msf
module Ui
module Console
module CommandDispatcher
#
Method cmd_handler
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cmd_handler(*args)
# Display the help banner if no arguments were passed
if args.empty?
cmd_handler_help
return
Method cmd_handler
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def cmd_handler(*args)
# Display the help banner if no arguments were passed
if args.empty?
cmd_handler_help
return
- 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 add_persist_job
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_persist_job(job_id)
if job_id && framework.jobs.has_key?(job_id.to_s)
handler_ctx = framework.jobs[job_id.to_s].ctx[1]
unless handler_ctx and handler_ctx.respond_to?(:replicant)
print_error("Add persistent job failed: job #{job_id} is not payload handler.")
Method add_persist_job
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_persist_job(job_id)
if job_id && framework.jobs.has_key?(job_id.to_s)
handler_ctx = framework.jobs[job_id.to_s].ctx[1]
unless handler_ctx and handler_ctx.respond_to?(:replicant)
print_error("Add persistent job failed: job #{job_id} is not payload handler.")
- 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
Avoid too many return
statements within this method. Open
return