Method format_prompt
has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring. Open
def format_prompt(str)
return str unless framework
# find the active session
session = framework.sessions.values.find { |session| session.interacting }
- 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 run
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def run(&block)
begin
require 'pry'
# pry history will not be loaded by default when pry is used as a breakpoint like `binding.pry`
Pry.config.history_load = 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
File shell.rb
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rex/text/color'
module Rex
module Ui
module Text
Method format_prompt
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
def format_prompt(str)
return str unless framework
# find the active session
session = framework.sessions.values.find { |session| session.interacting }
Method run
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run(&block)
begin
require 'pry'
# pry history will not be loaded by default when pry is used as a breakpoint like `binding.pry`
Pry.config.history_load = false
Avoid deeply nested control flow statements. Open
formatted << (sysinfo.nil? ? default : sysinfo['Computer'])
Avoid deeply nested control flow statements. Open
formatted << (sysinfo.nil? ? default : sysinfo['Architecture'])
Avoid deeply nested control flow statements. Open
formatted << (session.respond_to?(:fs) ? session.fs.dir.getwd(refresh: false) : default)
Avoid deeply nested control flow statements. Open
formatted << (session.respond_to?(:sys) ? session.sys.config.getuid(refresh: false) : default)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(prompt, prompt_char = '>', histfile = nil, framework = nil, name = nil)
Method get_input_line
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_input_line
line = "\\\n"
prompt_needs_reset = false
self.cont_flag = 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
Method init_tab_complete
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def init_tab_complete
if (self.input and self.input.supports_readline)
# Unless cont_flag because there's no tab complete for continuation lines
self.input = Input::Readline.new(lambda { |str| tab_complete(str) unless cont_flag })
self.input.output = self.output
- 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"