Showing 11 of 11 total issues
Method decode_arguments!
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def decode_arguments!(params_definition, arg_values, auto_help, commands_stack=[])
result = {}
parser_opts_copy = nil # not available outside the block
arg_definitions = {} # { 'name' => mandatory? }
Method decode_command!
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def decode_command!(params_definition, arguments, auto_help, commands_stack=[])
commands_definition = params_definition.first
# Set the `command` variable only after; in the case where we print the help, this variable
# must be unset.
Method decode_command!
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def decode_command!(params_definition, arguments, auto_help, commands_stack=[])
commands_definition = params_definition.first
# Set the `command` variable only after; in the case where we print the help, this variable
# must be unset.
- 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 decode_arguments!
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def decode_arguments!(params_definition, arg_values, auto_help, commands_stack=[])
result = {}
parser_opts_copy = nil # not available outside the block
arg_definitions = {} # { 'name' => mandatory? }
- 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 decode
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def decode(*definition_and_options)
params_definition, options = decode_definition_and_options(definition_and_options)
arguments = options.fetch(:arguments, ARGV)
long_help = options[:long_help]
Method decode_definition_and_options
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def decode_definition_and_options(definition_and_options)
# Only a hash (commands)
if definition_and_options.size == 1 && definition_and_options.first.is_a?(Hash)
options = definition_and_options.first.each_with_object({}) do |(key, value), current_options|
current_options[key] = definition_and_options.first.delete(key) if key.is_a?(Symbol)
- 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 decode
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def decode(*definition_and_options)
params_definition, options = decode_definition_and_options(definition_and_options)
arguments = options.fetch(:arguments, ARGV)
long_help = options[:long_help]
- 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 process_regular_argument!
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def process_regular_argument!(arg_values, result, commands_stack, arg_name, arg_is_mandatory)
Method process_varargs!
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def process_varargs!(arg_values, result, commands_stack, arg_name, arg_is_mandatory)
Method print_help
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def print_help(output, long_help)
parser_opts_help = parser_opts_copy.to_s
if commands_stack.size > 0
parser_opts_help = parser_opts_help.sub!('[options]', commands_stack.join(' ') + ' [options]')
- 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 process_option_definition!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def process_option_definition!(param_definition, parser_opts, result)
# Work on a copy; in at least one case (data type definition), we perform destructive
# operations.
#
param_definition = param_definition.dup
- 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"