Showing 36 of 50 total issues
Avoid deeply nested control flow statements. Open
elsif !@argv.empty?
value = opt.multi_argument? ? consume_arguments : @argv.shift
Avoid deeply nested control flow statements. Open
if opt.multi_argument? &&
!(consumed = consume_arguments).empty?
value = [other_singles] + consumed
end
Avoid deeply nested control flow statements. Open
value = opt.multi_argument? ? consume_arguments : @argv.shift
Avoid deeply nested control flow statements. Open
elsif !@argv.empty?
value = opt.multi_argument? ? consume_arguments : @argv.shift
Avoid deeply nested control flow statements. Open
value = opt.multi_argument? ? consume_arguments : @argv.shift
Method initialize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize(param_or_message, arity = nil)
if param_or_message.is_a?(Parameter)
@param = param_or_message
prefix = param.arity < 0 ? "at least " : ""
expected_arity = param.arity < 0 ? param.arity.abs - 1 : param.arity
- 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 initialize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize(environments, check_invalid_params: true,
raise_on_parse_error: false)
@environments = environments
@check_invalid_params = check_invalid_params
@error_aggregator =
- 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 deeply nested control flow statements. Open
if opt.multi_argument? &&
!(consumed = consume_arguments).empty?
value = [rest] + consumed
end
Method initialize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize(keywords, check_invalid_params: true,
raise_on_parse_error: false)
@keywords = keywords
@check_invalid_params = check_invalid_params
@error_aggregator =
- 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 parse
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse(argv)
@argv = argv.dup
loop do
kwarg, value = next_keyword
- 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 consume_arguments
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def consume_arguments(values: [])
while (value = @argv.first) && !option?(value)
val = @argv.shift
parts = val.include?("&") ? val.split(/&/) : [val]
parts.each { |part| values << part }
- 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 format_parameter_usage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def format_parameter_usage(param, param_name)
args = []
if 0 < param.arity
args << "[" if param.optional?
args << param_name
- 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 parse
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse(argv, env)
argv = argv.dup
params = {}
errors = []
ignored = []
- 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 initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize(arguments, check_invalid_params: true,
raise_on_parse_error: false)
@arguments = arguments
@error_aggregator =
ErrorAggregator.new(raise_on_parse_error: raise_on_parse_error)
- 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 call
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def call(param, value)
return Result.success(value) if !param.convert? || value.nil?
cast = param.convert
cast = cast.is_a?(Proc) ? cast : Conversions[cast]
- 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 assign_argument
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def assign_argument(arg, values)
val = case values.size
when 0
if arg.default?
case arg.default
- 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"