manyfold3d/mittsu-mesh_analysis

View on GitHub

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?
Severity: Minor
Found in lib/mittsu/mesh_analysis/winged_edge_geometry.rb - About 1 hr to fix

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)
Severity: Minor
Found in lib/mittsu/mesh_analysis/winged_edge_geometry.rb - About 1 hr to fix

    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
    Severity: Minor
    Found in lib/mittsu/mesh_analysis/winged_edge_geometry.rb - About 1 hr to fix

    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
    Severity: Minor
    Found in lib/mittsu/mesh_analysis/winged_edge_geometry.rb - About 1 hr to fix

    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
    Severity: Minor
    Found in lib/mittsu/mesh_analysis/winged_edge_geometry.rb - About 1 hr to fix

      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)
      Severity: Minor
      Found in lib/mittsu/mesh_analysis/winged_edge_geometry.rb - About 55 mins to fix

      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
      Severity: Minor
      Found in lib/mittsu/mesh_analysis/winged_edge.rb - About 35 mins to fix

      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
      Severity: Minor
      Found in lib/mittsu/mesh_analysis/modifiers/decimator.rb - About 25 mins to fix

      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

      Severity
      Category
      Status
      Source
      Language