danini-the-panini/mittsu

View on GitHub

Showing 226 of 659 total issues

Method intersects_box? has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def intersects_box?(box)
      p1 = Mittsu::Vector3.new
      p2 = Mittsu::Vector3.new
      planes = self.planes
      6.times do |i|
Severity: Minor
Found in lib/mittsu/math/frustum.rb - About 2 hrs 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 set_particle_buffers has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def set_particle_buffers(hint)
      if @vertices_need_update
        @vertices.each_with_index do |vertex, v|
          offset = v * 3

Severity: Minor
Found in lib/mittsu/renderers/opengl/core/geometry.rb - About 2 hrs 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 set_line_buffers has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def set_line_buffers(hint)
      if @vertices_need_update
        @vertices.each_with_index do |vertex, v|
          offset = v * 3

Severity: Major
Found in lib/mittsu/renderers/opengl/core/geometry.rb - About 2 hrs to fix

    Method init_mesh_buffers has 69 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def init_mesh_buffers(object)
          geometry = object.geometry
    
          nvertices = @faces3.length * 3
          nvertices2 = nvertices * 2
    Severity: Major
    Found in lib/mittsu/renderers/opengl/opengl_geometry_group.rb - About 2 hrs to fix

      Method create_texture has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def create_texture(where, name, source_file, repeat, offset, wrap, anisotropy)
            full_path = File.join(texture_path, source_file)
      
            loader = Handlers.get(full_path)
      
      
      Severity: Minor
      Found in lib/mittsu/loaders/loader.rb - About 2 hrs 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 merge has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def merge(geometry, matrix = nil, material_index_offset = nil)
            if !geometry.is_a? Mittsu::Geometry
              puts('ERROR: Mittsu::Geometry#merge: geometry not an instance of Mittsu::Geometry.', geometry.inspect)
              return
            end
      Severity: Minor
      Found in lib/mittsu/core/geometry.rb - About 2 hrs 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 set_axis_angle_from_rotation_matrix has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def set_axis_angle_from_rotation_matrix(m)
            # http:#www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm
            # assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
            angle, x1, y1, z1 = nil    # variables for result
            epsilon = 0.01    # margin to allow for rounding errors
      Severity: Major
      Found in lib/mittsu/math/vector4.rb - About 2 hrs to fix

        Method set_particle_buffers has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def set_particle_buffers(hint)
              if @vertices_need_update
                @vertices.each_with_index do |vertex, v|
                  offset = v * 3
        
        
        Severity: Major
        Found in lib/mittsu/renderers/opengl/core/geometry.rb - About 2 hrs to fix

          Method set_from_rotation_matrix has 65 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def set_from_rotation_matrix(m, order, update = true)
                # assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
                te = m.elements
                m11 = te[0]; m12 = te[4]; m13 = te[8]
                m21 = te[1]; m22 = te[5]; m23 = te[9]
          Severity: Major
          Found in lib/mittsu/math/euler.rb - About 2 hrs to fix

            Method set_axis_angle_from_rotation_matrix has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                def set_axis_angle_from_rotation_matrix(m)
                  # http:#www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm
                  # assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
                  angle, x1, y1, z1 = nil    # variables for result
                  epsilon = 0.01    # margin to allow for rounding errors
            Severity: Minor
            Found in lib/mittsu/math/vector4.rb - About 2 hrs 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 initialize has 64 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def initialize(radius = 50.0, width_segments = 8, height_segments = 6, phi_start = 0.0, phi_length = (::Math::PI * 2.0), theta_start = 0.0, theta_length = ::Math::PI)
                  super()
            
                  @type = 'SphereGeometry'
            
            
            Severity: Major
            Found in lib/mittsu/extras/geometries/sphere_geometry.rb - About 2 hrs to fix

              Method from_buffer_geometry has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def from_buffer_geometry(geometry)
                    scope = self
                    vertices = geometry[:position].array
                    indices = geometry[:index].nil? ? nil : geometry[:index].array
                    normals = geometry[:normal].nil? ? nil : geometry[:normal].array
              Severity: Major
              Found in lib/mittsu/core/geometry.rb - About 2 hrs to fix

                Method compute_offsets has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def compute_offsets(size = 65535)
                      # WebGL limits type of index buffer values to 16-bit.
                      # TODO: check what the limit is for OpenGL, as we aren't using WebGL here
                
                      indices = self[:index].array
                Severity: Major
                Found in lib/mittsu/core/buffer_geometry.rb - About 2 hrs to fix

                  Class OBJLoader has 23 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                    class OBJLoader
                      include EventDispatcher
                  
                      FLOAT                = /[\d|.|+|\-|e]+/
                  
                  
                  Severity: Minor
                  Found in lib/mittsu/loaders/obj_loader.rb - About 2 hrs to fix

                    Class Box2 has 23 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                      class Box2
                        attr_accessor :min, :max
                    
                        def initialize(min = nil, max = nil)
                          @min = min || Mittsu::Vector2.new(Float::INFINITY, Float::INFINITY)
                    Severity: Minor
                    Found in lib/mittsu/math/box2.rb - About 2 hrs to fix

                      File shadow_map_plugin.rb has 269 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      require 'mittsu/math'
                      require 'mittsu/renderers/opengl_render_target'
                      
                      module Mittsu
                        class ShadowMapPlugin
                      Severity: Minor
                      Found in lib/mittsu/renderers/opengl/plugins/shadow_map_plugin.rb - About 2 hrs to fix

                        File quaternion.rb has 268 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        module Mittsu
                          class Quaternion
                            EPS = 0.000001
                        
                            attr_reader :x, :y, :z, :w
                        Severity: Minor
                        Found in lib/mittsu/math/quaternion.rb - About 2 hrs to fix

                          Method parse has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def parse(text)
                                lines = text.split("\n")
                                info = {}
                                delimiter_pattern = /\s+/
                                materials_info = {}
                          Severity: Minor
                          Found in lib/mittsu/loaders/mtl_loader.rb - About 2 hrs 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 distance_sq_to_segment has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def distance_sq_to_segment(v0, v1, point_on_ray = nil, point_on_segment = nil)
                                seg_center = Mittsu::Vector3.new
                                seg_dir = Mittsu::Vector3.new
                                diff = Mittsu::Vector3.new
                                # from http:#www.geometrictools.com/LibMathematics/Distance/Wm5DistRay3Segment3.cpp
                          Severity: Major
                          Found in lib/mittsu/math/ray.rb - About 2 hrs to fix

                            Method initialize has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def initialize(radius = 100.0, tube = 40.0, radial_segments = 64, tubular_segments = 8, p_val = 2, q_val = 3)
                                  super()
                            
                                  @type = 'TorusKnotBufferGeometry'
                            
                            
                            Severity: Major
                            Found in lib/mittsu/extras/geometries/torus_knot_buffer_geometry.rb - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language