Method run_single
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
def run_single(line, propagate_errors: false)
arguments = parse_line(line)
method = arguments.shift
cmd_status = nil # currently either nil or :handled, more statuses can be added in the future
error = 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 cmd_help
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
def cmd_help(cmd=nil, *ignored)
if cmd
help_found = false
cmd_found = false
shell.dispatcher_stack.each do |dispatcher|
- 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 dispatcher_shell.rb
has 407 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'pp'
require 'rex/text/table'
require 'erb'
module Rex
Method tab_complete_stub
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def tab_complete_stub(original_str, split_str)
*preceding_tokens, current_token = split_str[:tokens]
return nil unless current_token
items = []
- 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_single
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run_single(line, propagate_errors: false)
arguments = parse_line(line)
method = arguments.shift
cmd_status = nil # currently either nil or :handled, more statuses can be added in the future
error = false
Method shellsplitex
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def shellsplitex(line)
tokens = []
field_value = String.new
field_begin = nil
- 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_help
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cmd_help(cmd=nil, *ignored)
if cmd
help_found = false
cmd_found = false
shell.dispatcher_stack.each do |dispatcher|
Method tab_complete_stub
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def tab_complete_stub(original_str, split_str)
*preceding_tokens, current_token = split_str[:tokens]
return nil unless current_token
items = []
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(prompt, prompt_char = '>', histfile = nil, framework = nil, name = nil)
Method tab_complete_directory
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def tab_complete_directory(str, words)
directory = str[-1] == File::SEPARATOR ? str : File.dirname(str)
filename = str[-1] == File::SEPARATOR ? '' : File.basename(str)
entries = Dir.entries(directory).select { |fp| fp.start_with?(filename) }
dirs = entries - ['.', '..']
- 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 tab_complete_generic
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def tab_complete_generic(fmt, str, words)
last_word = words[-1]
fmt = fmt.select { |key, value| last_word == key || !words.include?(key) }
val = fmt[last_word]
- 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 tab_complete_filenames
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def tab_complete_filenames(str, words)
matches = ::Readline::FILENAME_COMPLETION_PROC.call(str)
if matches and matches.length == 1 and File.directory?(matches[0])
dir = matches[0]
dir += File::SEPARATOR if dir[-1,1] != File::SEPARATOR
- 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"