danini-the-panini/mittsu

View on GitHub

Showing 226 of 659 total issues

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

    def compute_tangents
      # based on http:#www.terathon.com/code/tangent.html
      # tangents go to vertices
      tan1 = []; tan2 = [],
      sdir = Mittsu::Vector3.new; tdir = Mittsu::Vector3.new
Severity: Major
Found in lib/mittsu/core/geometry.rb - About 2 hrs to fix

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

        def compute_vertex_normals
          if self[:position]
            positions = self[:position].array
            if self[:normal].nil?
              self[:normal] = Mittsu::BufferAttribute.new(Array.new(positions.length), 3)
    Severity: Major
    Found in lib/mittsu/core/buffer_geometry.rb - About 2 hrs to fix

      File geometry.rb has 263 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'mittsu/renderers/opengl/opengl_geometry_like'
      
      module Mittsu
        class Geometry
          include OpenGLGeometryLike
      Severity: Minor
      Found in lib/mittsu/renderers/opengl/core/geometry.rb - About 2 hrs to fix

        Method set_program has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def set_program(camera, lights, fog, material, object)
              @_used_texture_units = 0
              if material.needs_update?
                deallocate_material(material) if material.program
        
        
        Severity: Major
        Found in lib/mittsu/renderers/opengl_renderer.rb - About 2 hrs to fix

          Method set has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def set(slot, renderer)
                @renderer = renderer
          
                if image.length == 6
                  if needs_update?
          Severity: Major
          Found in lib/mittsu/renderers/opengl/textures/cube_texture.rb - About 2 hrs to fix

            Method init_mesh_buffers has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                def init_mesh_buffers(object)
                  geometry = object.geometry
            
                  nvertices = @faces3.length * 3
                  nvertices2 = nvertices * 2
            Severity: Minor
            Found in lib/mittsu/renderers/opengl/opengl_geometry_group.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 a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                def initialize(radius_top = 20.0, radius_bottom = 20.0, height = 100.0, radial_segments = 8, height_segments = 1, open_ended = false, theta_start = 0.0, theta_length = (::Math::PI * 2.0))
                  super()
            
                  @type = 'CylinderGeometry'
            
            
            Severity: Minor
            Found in lib/mittsu/extras/geometries/cylinder_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 initialize has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def initialize(func, slices, stacks)
                  super()
            
                  @type = 'ParametricBufferGeometry'
            
            
            Severity: Major
            Found in lib/mittsu/extras/geometries/parametric_buffer_geometry.rb - About 2 hrs to fix

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

                  def initialize(width, height, width_segments = 1, height_segments = 1)
                    super()
              
                    @type = 'PlaneBufferGeometry'
              
              
              Severity: Major
              Found in lib/mittsu/extras/geometries/plane_buffer_geometry.rb - About 2 hrs to fix

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

                      def initialize(width, height, title, antialias: 0)
                        ::GLFW.Init
                
                        ::GLFW.WindowHint ::GLFW::OPENGL_PROFILE, ::GLFW::OPENGL_CORE_PROFILE
                        ::GLFW.WindowHint ::GLFW::OPENGL_FORWARD_COMPAT, GL::TRUE
                Severity: Major
                Found in lib/mittsu/renderers/glfw_window.rb - About 2 hrs to fix

                  Class Geometry has 21 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                    class Geometry
                      include EventDispatcher
                  
                      MorphNormal = Struct.new(:face_normals, :vertex_normals)
                      Normal = Struct.new(:a, :b, :c)
                  Severity: Minor
                  Found in lib/mittsu/core/geometry.rb - About 2 hrs to fix

                    Class BufferGeometry has 21 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                      class BufferGeometry
                        include EventDispatcher
                    
                        DrawCall = Struct.new(:start, :count, :index)
                    
                    
                    Severity: Minor
                    Found in lib/mittsu/core/buffer_geometry.rb - About 2 hrs to fix

                      Method build_plane has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def build_plane(u, v, udir, vdir, width, height, depth, material_index)
                            grid_x = @width_segments
                            grid_y = @height_segments
                            width_half = width / 2.0
                            height_half = height / 2.0
                      Severity: Major
                      Found in lib/mittsu/extras/geometries/box_geometry.rb - About 2 hrs to fix

                        Method render_objects_immediate has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def render_objects_immediate(render_list, material_type, camera, lights, fog, override_material)
                              material = nil
                              render_list.each do |opengl_object|
                                object = opengl_object.object
                                if object.visible
                        Severity: Minor
                        Found in lib/mittsu/renderers/opengl_renderer.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 render_objects has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def render_objects(render_list, camera, lights, fog, override_material)
                              material = nil
                              render_list.each do |opengl_object|
                                puts "-- RENDER_OBJECT #{opengl_object.name}" if DEBUG
                                object = opengl_object.object
                        Severity: Minor
                        Found in lib/mittsu/renderers/opengl_renderer.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 intersect_box has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def intersect_box(box, target = Mittsu::Vector3.new)
                              # http:#www.scratchapixel.com/lessons/3d-basic-lessons/lesson-7-intersecting-simple-shapes/ray-box-intersection/
                              invdirx = 1.0 / @direction.x
                              invdiry = 1.0 / @direction.y
                              invdirz = 1.0 / @direction.z
                        Severity: Minor
                        Found in lib/mittsu/math/ray.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 compute_offsets has a Cognitive Complexity of 16 (exceeds 5 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: Minor
                        Found in lib/mittsu/core/buffer_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 initialize has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def initialize(points, segments = 12, phi_start = 0.0, phi_length = (::Math::PI * 2.0))
                              super()
                        
                              @type = 'LatheGeometry'
                        
                        
                        Severity: Major
                        Found in lib/mittsu/extras/geometries/lathe_geometry.rb - About 2 hrs to fix

                          Method set has 16 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def set(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44)
                          Severity: Major
                          Found in lib/mittsu/math/matrix4.rb - About 2 hrs to fix

                            Method set_blending has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def set_blending(blending, blend_equation = nil, blend_src = nil, blend_dst = nil, blend_equation_alpha = nil, blend_src_alpha = nil, blend_dst_alpha = nil)
                                  if blending != @current_blending
                                    case blending
                                    when NoBlending
                                      GL.Disable(GL::BLEND)
                            Severity: Minor
                            Found in lib/mittsu/renderers/opengl/opengl_state.rb - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language