danini-the-panini/mittsu

View on GitHub

Showing 226 of 659 total issues

Class Matrix4 has 38 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Matrix4
    attr_accessor :elements

    DIMENSIONS = 4

Severity: Minor
Found in lib/mittsu/math/matrix4.rb - About 5 hrs to fix

    Method render has 120 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def render(scene, camera)
          return unless @renderer.shadow_map_enabled
    
          lights = []
          fog = nil
    Severity: Major
    Found in lib/mittsu/renderers/opengl/plugins/shadow_map_plugin.rb - About 4 hrs to fix

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

          def compute_tangents
            # based on http://www.terathon.com/code/tangent.html
            # (per vertex tangents)
      
            if [:index, :position, :normal, :uv].any { |s| !@attributes.has_key?}
      Severity: Major
      Found in lib/mittsu/core/buffer_geometry.rb - About 4 hrs to fix

        Method distance_sq_to_segment has a Cognitive Complexity of 29 (exceeds 5 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: Minor
        Found in lib/mittsu/math/ray.rb - About 4 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 100 lines of code (exceeds 25 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: Major
        Found in lib/mittsu/extras/geometries/cylinder_geometry.rb - About 4 hrs to fix

          Method set_from_rotation_matrix has a Cognitive Complexity of 27 (exceeds 5 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: Minor
          Found in lib/mittsu/math/euler.rb - About 3 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 load_uniforms_generic has 97 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def load_uniforms_generic(uniforms)
                uniforms.each do |(uniform, location)|
                  # needs_update property is not added to all uniforms.
                  next if uniform.needs_update == false || location == -1
          
          
          Severity: Major
          Found in lib/mittsu/renderers/opengl_renderer.rb - About 3 hrs to fix

            Method set_program has a Cognitive Complexity of 26 (exceeds 5 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: Minor
            Found in lib/mittsu/renderers/opengl_renderer.rb - About 3 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 convert has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
            Open

                  def convert(materials_info)
                    return materials_info if !@options
            
                    converted = {}
            
            
            Severity: Minor
            Found in lib/mittsu/loaders/mtl_loader.rb - About 3 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 create_material has 84 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def create_material(m, texture_path)
                  # defaults
            
                  mtype = 'MeshLambertMaterial'
                  mpars = {
            Severity: Major
            Found in lib/mittsu/loaders/loader.rb - About 3 hrs to fix

              Class Window has 28 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class Window
                    attr_accessor :key_press_handler, :key_release_handler, :key_repeat_handler, :char_input_handler, :cursor_pos_handler, :mouse_button_press_handler, :mouse_button_release_handler, :scroll_handler, :framebuffer_size_handler
              
                    def initialize(width, height, title, antialias: 0)
                      ::GLFW.Init
              Severity: Minor
              Found in lib/mittsu/renderers/glfw_window.rb - About 3 hrs to fix

                File object_3d.rb has 303 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                require 'securerandom'
                
                module Mittsu
                  class Object3D
                    include EventDispatcher
                Severity: Minor
                Found in lib/mittsu/core/object_3d.rb - About 3 hrs to fix

                  Method make_rotation_from_euler has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def make_rotation_from_euler(euler)
                        te = self.elements
                        x, y, z = euler.x, euler.y, euler.z
                        a, b = ::Math.cos(x), ::Math.sin(x)
                        c, d = ::Math.cos(y), ::Math.sin(y)
                  Severity: Major
                  Found in lib/mittsu/math/matrix4.rb - About 3 hrs to fix

                    Method raycast has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def raycast(raycaster, intersects)
                          precision = raycaster.line_precision
                          precision_sq = precision * precision
                    
                          @geometry.compute_bounding_sphere if @geometry.bounding_sphere.nil?
                    Severity: Major
                    Found in lib/mittsu/objects/line.rb - About 3 hrs to fix

                      Class Quaternion has 27 methods (exceeds 20 allowed). Consider refactoring.
                      Open

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

                        Method to_json has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def to_json
                              output = {
                                metadata: {
                                  version: 4.0,
                                  type: 'BufferGeometry',
                        Severity: Major
                        Found in lib/mittsu/core/geometry.rb - About 3 hrs to fix

                          Method update_object has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def update_object(object)
                                geometry = object.geometry
                          
                                if geometry.is_a? BufferGeometry
                                  # TODO: geometry vertex array ?????
                          Severity: Minor
                          Found in lib/mittsu/renderers/opengl_renderer.rb - About 3 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 setup_buffers has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def setup_buffers
                                return unless @framebuffer.nil?
                          
                                # TODO: when OpenGLRenderTargetCube exists
                                is_cube = false # render_target.is_a? OpenGLRenderTargetCube
                          Severity: Minor
                          Found in lib/mittsu/renderers/opengl_render_target.rb - About 3 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 to_json has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def to_json
                                output = {
                                  metadata: {
                                    version: 4.0,
                                    type: 'BufferGeometry',
                          Severity: Minor
                          Found in lib/mittsu/core/geometry.rb - About 3 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

                          Class Box3 has 26 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                            class Box3
                              attr_accessor :min, :max
                          
                              def initialize(min = nil, max = nil)
                                @min = min || Mittsu::Vector3.new(Float::INFINITY, Float::INFINITY, Float::INFINITY)
                          Severity: Minor
                          Found in lib/mittsu/math/box3.rb - About 3 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language