danini-the-panini/mittsu-opengl

View on GitHub

Showing 67 of 251 total issues

Method cache_uniform_locations has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def cache_uniform_locations(uniforms, parameters)
      identifiers = [
        'viewMatrix',
        'modelViewMatrix',
        'projectionMatrix',
Severity: Minor
Found in lib/mittsu/opengl/program.rb - About 1 hr to fix

    Method init_custom_attributes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def init_custom_attributes(object)
          material = object.material
    
          nvertices = @vertices.length
    
    
    Severity: Minor
    Found in lib/mittsu/opengl_implementation/core/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 project has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def project(renderer)
          puts " --- PROJECT #{self.name}" if DEBUG
          @renderer = renderer
          return unless visible
          init
    Severity: Minor
    Found in lib/mittsu/opengl_implementation/core/object_3d.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 render_buffer has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def render_buffer(camera, lights, fog, material, geometry_group, object)
          puts "--- RENDER #{object.name}" if DEBUG
          return unless material.visible
    
          geometry_group.renderer = self
    Severity: Minor
    Found in lib/mittsu/opengl/renderer.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 init_geometry_groups has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def init_geometry_groups(object)
          material = object.material
          add_buffers = false
    
          if @groups.nil? || @groups_need_update
    Severity: Minor
    Found in lib/mittsu/opengl_implementation/core/geometry.rb - About 1 hr to fix

      Method allocate_shadows has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def allocate_shadows(lights)
            max_shadows = 0
      
            lights.each do |light|
              next unless light.cast_shadow
      Severity: Minor
      Found in lib/mittsu/opengl_implementation/materials/material.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 init has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def init
            if !@initted
              puts " --- INIT #{self.name}" if DEBUG
      
              @initted = true
      Severity: Minor
      Found in lib/mittsu/opengl_implementation/core/object_3d.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 fire_joystick_button_event has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def fire_joystick_button_event(joystick, button, pressed)
              if !@joystick_buttons[joystick][button] && pressed
                @joystick_button_press_handler.call(joystick, button) unless @joystick_button_press_handler.nil?
              elsif @joystick_buttons[joystick][button] && !pressed
                @joystick_button_release_handler.call(joystick, button) unless @joystick_button_release_handler.nil?
      Severity: Minor
      Found in lib/mittsu/glfw/window.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 set_blending has 7 arguments (exceeds 4 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)
      Severity: Major
      Found in lib/mittsu/opengl/state.rb - About 50 mins to fix

        Avoid deeply nested control flow statements.
        Open

                    if custom_attribute[:bound_to].nil? || custom_attribute[:bound_to] == :vertices
                      @faces3.each do |chf|
                        face = obj_faces[chf];
        
                        v1 = custom_attribute[:value][face.a]
        Severity: Major
        Found in lib/mittsu/opengl/geometry_group.rb - About 45 mins to fix

          Method set_parameters has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def set_parameters(texture_type, is_image_power_of_two)
                if is_image_power_of_two
                  GL.TexParameteri(texture_type, GL::TEXTURE_WRAP_S, GL::MITTSU_PARAMS[wrap_s])
                  GL.TexParameteri(texture_type, GL::TEXTURE_WRAP_T, GL::MITTSU_PARAMS[wrap_t])
          
          
          Severity: Minor
          Found in lib/mittsu/opengl_implementation/textures/texture.rb - About 45 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 render_buffer has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def render_buffer(camera, lights, fog, material, geometry_group, update_buffers)
          Severity: Minor
          Found in lib/mittsu/opengl_implementation/objects/mesh.rb - About 45 mins to fix

            Method render_buffer has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def render_buffer(camera, lights, fog, material, geometry_group, update_buffers)
            Severity: Minor
            Found in lib/mittsu/opengl_implementation/objects/point_cloud.rb - About 45 mins to fix

              Method init_geometry_groups has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def init_geometry_groups(object)
                    material = object.material
                    add_buffers = false
              
                    if @groups.nil? || @groups_need_update
              Severity: Minor
              Found in lib/mittsu/opengl_implementation/core/geometry.rb - About 45 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

              Avoid deeply nested control flow statements.
              Open

                                if @renderer.compressed_texture_formats.include?(gl_format)
                                  GL.CompressedTexImage2D(GL::TEXTURE_CUBE_MAP_POSITIVE_X + i, j, gl_format, mipmap.width, mipmap.height, 0, mipmap.data)
                                else
                                  puts "WARNING: Mittsu::OpenGLCubeTexture: Attempt to load unsupported compressed texture format in #set"
                                end
              Severity: Major
              Found in lib/mittsu/opengl_implementation/textures/cube_texture.rb - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                          elsif custom_attribute[:size] == 4
                            if custom_attribute[:bound_to].nil? || custom_attribute[:bound_to] == :vertices
                              @faces3.each do |chf|
                                face = obj_faces[chf]
                
                
                Severity: Major
                Found in lib/mittsu/opengl/geometry_group.rb - About 45 mins to fix

                  Method render_buffer has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def render_buffer(camera, lights, fog, material, geometry_group, update_buffers)
                  Severity: Minor
                  Found in lib/mittsu/opengl_implementation/objects/line.rb - About 45 mins to fix

                    Method render_buffer has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def render_buffer(camera, lights, fog, material, geometry_group, object)
                    Severity: Minor
                    Found in lib/mittsu/opengl/renderer.rb - About 45 mins to fix

                      Method update_specific has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def update_specific
                            gl_format = GL::MITTSU_PARAMS[format]
                            gl_type = GL::MITTSU_PARAMS[type]
                      
                            mipmaps.each_with_index do |mipmap, i|
                      Severity: Minor
                      Found in lib/mittsu/opengl_implementation/textures/compressed_texture.rb - About 45 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 render_objects_immediate has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def render_objects_immediate(render_list, material_type, camera, lights, fog, override_material)
                      Severity: Minor
                      Found in lib/mittsu/opengl/renderer.rb - About 45 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language