Showing 19 of 19 total issues
Method parse_long
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def parse_long(tokens, options)
long, eq, value = tokens.move.partition('=')
raise RuntimeError unless long.start_with?('--')
- 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_shorts
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def parse_shorts(tokens, options)
token = tokens.move
unless token.start_with?('-') && !token.start_with?('--')
raise RuntimeError
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 fix_repeating_arguments
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def fix_repeating_arguments
either.children.map(&:children).each do |case_|
case_.select { |c| case_.count(c) > 1 }.each do |e|
if e.instance_of?(Argument) || (e.instance_of?(Option) && e.argcount.positive?)
if e.value.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 parse_atom
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def parse_atom(tokens, options)
token = tokens.current
if ['(', '['].include? token
tokens.move
- 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_shorts
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_shorts(tokens, options)
token = tokens.move
unless token.start_with?('-') && !token.start_with?('--')
raise RuntimeError
end
Method parse_long
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_long(tokens, options)
long, eq, value = tokens.move.partition('=')
raise RuntimeError unless long.start_with?('--')
Method either
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def either
ret = []
groups = [[self]]
while groups.count.positive?
children = groups.shift
Method match
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def match(left, collected = nil)
raise RuntimeError if children.count != 1
collected ||= []
l = left
- 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 match
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def match(left, collected = nil)
collected ||= []
pos, match = single_match(left)
return [false, left, collected] if match.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 fix_identities
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def fix_identities(uniq = nil)
unless instance_variable_defined?(:@children)
return self
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 parse_atom
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_atom(tokens, options)
token = tokens.current
if ['(', '['].include? token
tokens.move
Method parse_expr
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse_expr(tokens, options)
seq = parse_seq(tokens, options)
if tokens.current != '|'
return seq
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 parse_argv
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse_argv(tokens, options, options_first = false)
parsed = []
until tokens.current.nil?
if tokens.current == '--' || options_first
return parsed + tokens.map { |v| Argument.new(nil, v) }
- 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 dump_patterns
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def dump_patterns(pattern, indent = 0)
ws = ' ' * 4 * indent
out = ''
if pattern.instance_of?(Array)
if pattern.count.positive?
- 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 either
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def either
ret = []
groups = [[self]]
while groups.count.positive?
children = groups.shift
- 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 tokens.current.nil?
raise tokens.error, "#{short} requires argument"
end
Method match
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def match(left, collected = nil)
collected ||= []
outcomes = []
children.each do |p|
matched, = found = p.match(left, collected)
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def self.parse(option_description)
short = nil
long = nil
argcount = 0
value = 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 single_match
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def single_match(left)
left.each_with_index do |p, n|
next unless p.instance_of?(Argument)
return n, Command.new(name, true) if p.value == 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"