Showing 45 of 76 total issues
Method match
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def match
u = g.partition[0]
m = []
loop do
Method scan_vertex
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def scan_vertex(v)
assert_label(@in_blossom[v], LBL_S)
augmented = false
@neighb_end[v].each do |p|
- 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 scan_blossom
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def scan_blossom(v, w)
# > Trace back from v and w, placing breadcrumbs as we go.
path = []
base = nil
until v.nil? && w.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 augment_matching
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def augment_matching(k)
v, w = @edges[k].to_a
[[v, 2 * k + 1], [w, 2 * k]].each do |(s, p)|
# > Match vertex s to remote endpoint p. Then trace back from s
# > until we find a single vertex, swapping matched and unmatched
- 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 scan_blossom
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def scan_blossom(v, w)
# > Trace back from v and w, placing breadcrumbs as we go.
path = []
base = nil
until v.nil? && w.nil?
Method set_w
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def set_w(edge, weight)
if edge[0].nil? || edge[1].nil?
raise ArgumentError, "Invalid edge: #{edge}"
end
unless weight.is_a?(Integer)
- 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 l
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def l(x, y, first, label, mate, q, visited_nodes)
Avoid deeply nested control flow statements. Open
if inblossom[w] != b and label[inblossom[w]] == 1:
d = slack(k)
if bk == -1 or d < bd:
bk = k
bd = d
Avoid deeply nested control flow statements. Open
if bk == -1 or d < bd:
bk = k
bd = d
if DEBUG and (bestedge[v] != -1 or bk != -1) and (bestedge[v] == -1 or bd != slack(bestedge[v])):
Avoid deeply nested control flow statements. Open
if isinstance(kslack, integer_types):
assert (kslack % 2) == 0
d = kslack // 2
else:
d = kslack / 2
Avoid deeply nested control flow statements. Open
if not allowedge[k]:
kslack = slack(k)
if kslack <= 0:
# edge k has zero slack => it is allowable
allowedge[k] = True
Method expand_t_blossom
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def expand_t_blossom(b)
assert(@label_end[b]).not_nil
entry_child = @in_blossom[@endpoint[@label_end[b] ^ 1]]
# > Move along the blossom until we get to the base.
- 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 deltatype == -1 or d < delta:
delta = d
deltatype = 2
deltaedge = bestedge[v]
Avoid deeply nested control flow statements. Open
if deltatype == -1 or d < delta:
delta = d
deltatype = 3
deltaedge = bestedge[b]
Avoid deeply nested control flow statements. Open
if inblossom[v] == inblossom[w]:
# this edge is internal to a blossom; ignore it
continue
if not allowedge[k]:
Avoid deeply nested control flow statements. Open
if label[b] == 1:
# top-level S-blossom: z = z + 2*delta
dualvar[b] += delta
elif label[b] == 2:
# top-level T-blossom: z = z - 2*delta
Avoid deeply nested control flow statements. Open
if allowedge[k]:
if label[inblossom[w]] == 0:
# (C1) w is a free vertex;
# label w with T and label its mate with S (R12).
assignLabel(w, 2, p ^ 1)
Method update_duals
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update_duals(delta)
(0...@nvertex).each do |v|
case @label[@in_blossom[v]]
when LBL_S
@dual[v] -= delta
- 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 blossom_leaves
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def blossom_leaves(b, ary = [])
if b < @nvertex
ary.push(b)
else
@blossom_children[b].each do |c|
- 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 r
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def r(v, w, label, mate)
# R1. [Match v to w ] Set t <- MATE(v), MATE(v) <- w.
# If MATE(t) != v, return (the path is completely re-matched)
t = mate[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"