Method process_command
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def process_command(command_args)
command_info = { :result => "" }
command_info[:result] << "+ #{command_args.join(" ")}\n" if @trace
command = deserialize(command_args)
- 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 start
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def start
restore_history
@client.connect unless @client.connected?
comp = proc { |s|
- 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 start
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def start
restore_history
@client.connect unless @client.connected?
comp = proc { |s|
Method describe_commands
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def describe_commands(command_list_width = 0)
command_list_width ||= 0
if !(command_list_width.is_a?(Integer) && command_list_width >= 0)
raise ArgumentError, "command_list_width should be a non-negative Integer."
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 do_describe_options
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def do_describe_options(command_help, text, indent_level = 0)
[:required, :repeated, :optional].each do |field_type|
if fields = command_help[field_type]
fields.each_pair do |name, help|
text << "\t" * indent_level
- 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"