Showing 41 of 69 total issues
Method test_visitor
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_visitor
visitor = DijkstraVisitor.new(@graph)
events = []
Method test_visitor
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_visitor
visitor = DijkstraVisitor.new(@graph)
events = []
Method test_north_graphs
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def test_north_graphs
name, nnodes, nedges = '', 0, 0
IO.foreach(NORTH_DIR + '/Graph.log') {
|line|
if /name:\s*(.*)\sformat: graphml\s+nodes: (\d+)\s+edges: (\d+)/ =~ line
- 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 to_s
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def to_s(leader = '', indent = ' ')
hdr = leader + @dot_string + (@name.nil? ? '' : ' ' + quote_ID(@name)) + " {\n"
options = @options.to_a.collect do |name, val|
unless val.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 test_option_quoting
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_option_quoting
node = DOT::Digraph.new({ "name" => "test_name", "comment" => "Comment with spaces" })
dot = node.to_s
assert_match(dot, /comment\s*=\s*"Comment with spaces"/)
Method test_option_quoting
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_option_quoting
node = DOT::Node.new({ "name" => "test_name", "comment" => "Comment with spaces" })
dot = node.to_s
assert_match(dot, /comment\s*=\s*"Comment with spaces"/)
Method test_option_quoting
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_option_quoting
node = DOT::Subgraph.new({ "name" => "test_name", "comment" => "Comment with spaces" })
dot = node.to_s
assert_match(dot, /comment\s*=\s*"Comment with spaces"/)
Method test_option_quoting
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_option_quoting
node = DOT::Graph.new({ "name" => "test_name", "comment" => "Comment with spaces" })
dot = node.to_s
assert_match(dot, /comment\s*=\s*"Comment with spaces"/)
Method setup
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setup
@capacities_map = {
[1, 2] => 3,
[1, 4] => 3,
[2, 3] => 4,
Method test_cycles
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_cycles
d_cycles = @dg.cycles
assert_equal 6, d_cycles.size
assert d_cycles.include?([6])
assert d_cycles.include?([7])
Method relax_edges
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def relax_edges(target = nil, break_on_target = false)
until @queue.empty?
u = @queue.pop
break if break_on_target && u == target
- 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 to_s
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def to_s
if @ports.nil? || @ports.empty?
n = (name.nil? || name.empty?) ? '' : "<#{name}>"
n + ((n.empty? || label.nil? || label.empty?) ? '' : ' ') + label.to_s
else
- 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 vertices_filtered_by
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def vertices_filtered_by(&filter)
implicit_graph do |g|
g.vertex_iterator do |b|
self.each_vertex { |v| b.call(v) if filter.call(v) }
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 condensation_graph
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def condensation_graph
raise NotDirectedError,
"condensation_graph only supported for directed graphs" unless directed?
# Get the component map for the strongly connected components.
- 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 maximum_flow
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def maximum_flow(source, sink)
raise ArgumentError.new("source and sink can't be equal") if source == sink
@flow_map = Hash.new(0)
@residual_capacity_map = lambda { |u, v| @edge_capacities_map.edge_property(u, v) - @flow_map[[u, 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 edges_filtered_by
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def edges_filtered_by(&filter)
implicit_graph do |g|
g.adjacent_iterator do |v, b|
self.each_adjacent(v) do |u|
b.call(u) if filter.call(v, u)
- 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 relax_edges
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def relax_edges
(@graph.size - 1).times do
@graph.each_edge do |u, v|
relax_edge(u, v)
relax_edge(v, u) unless @graph.directed?
- 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 bipartite_sets
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def bipartite_sets
raise NotUndirectedError.new('bipartite sets can only be found for an undirected graph') if directed?
bfs = BipartiteBFSIterator.new(self)
- 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 transitive_closure
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def transitive_closure
raise NotDirectedError,
"transitive_closure only supported for directed graphs" unless directed?
# Compute a condensation graph in order to hide cycles.
- 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 each_connected_component
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def each_connected_component
raise NotUndirectedError,
"each_connected_component only works " +
"for undirected graphs." if directed?
- 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"