Showing 8 of 12 total issues
Method flatten!
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def flatten!
@faces = []
@edges.each do |e0|
next if e0.nil?
if e0.left && @faces[e0.left].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 collapse
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def collapse(index, flatten: true)
# Find edge, reorder vertices and reload
e0 = edge(index)
if e0
move_vertex_to_end(e0.finish)
Method move_vertex_to_end
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def move_vertex_to_end(index)
return unless @vertices[index]
# Add move vertex to end of array
@vertices.push @vertices.slice!(index)
new_index = @vertices.count - 1
- 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 from_geometry
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def from_geometry(geometry, merge: true, normalize: true)
# Merge vertices unless told not to
geometry.merge_vertices if merge
# Vertices are the same
@vertices = geometry.vertices.clone
- 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 from_geometry
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def from_geometry(geometry, merge: true, normalize: true)
# Merge vertices unless told not to
geometry.merge_vertices if merge
# Vertices are the same
@vertices = geometry.vertices.clone
Method collapse
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def collapse(index, flatten: true)
# Find edge, reorder vertices and reload
e0 = edge(index)
if e0
move_vertex_to_end(e0.finish)
- 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 stitch
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def stitch(edge)
# Make sure the edges share a vertex and face
face = shared_face(edge)
return nil unless face && edge.coincident_at(edge)
# Flip incoming edge if it's not pointing the same way
- 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 decimate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def decimate(target_face_count, vertex_splits: false)
@geometry.flatten!
edge_collapses = edge_collapse_costs.sort_by { |x| x[:cost] }
splits = []
loop do
- 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"