danini-the-panini/mittsu-opengl

View on GitHub

Showing 251 of 251 total issues

Method make_groups has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def make_groups(uses_face_material = false)
      max_vertices_in_group = 65535 # TODO: OES_element_index_uint ???

      hash_map = {}

Severity: Minor
Found in lib/mittsu/opengl_implementation/core/geometry.rb - About 1 hr to fix

    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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              when :'mat3[]'
                if value.first.is_a? Matrix3
                  uniform.array ||= Array.new(9 * value.length) # Float32Array
      
                  value.each_with_index do |v, i|
      Severity: Major
      Found in lib/mittsu/opengl/renderer.rb and 1 other location - About 1 hr to fix
      lib/mittsu/opengl/renderer.rb on lines 680..690

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 51.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              when :'mat4[]'
                if value.first.is_a? Matrix4
                  uniform.array ||= Array.new(16 * value.length) # Float32Array
      
                  value.each_with_index do |v, i|
      Severity: Major
      Found in lib/mittsu/opengl/renderer.rb and 1 other location - About 1 hr to fix
      lib/mittsu/opengl/renderer.rb on lines 668..678

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 51.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

                if @colors_need_update
                  @colors.each_with_index do |color, c|
                    offset = c * 3;
          
                    @color_array[offset]     = color.r
          Severity: Major
          Found in lib/mittsu/opengl_implementation/core/geometry.rb and 3 other locations - About 50 mins to fix
          lib/mittsu/opengl_implementation/core/geometry.rb on lines 93..103
          lib/mittsu/opengl_implementation/core/geometry.rb on lines 106..116
          lib/mittsu/opengl_implementation/core/geometry.rb on lines 184..195

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 42.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

                if @vertices_need_update
                  @vertices.each_with_index do |vertex, v|
                    offset = v * 3
          
                    @vertex_array[offset]     = vertex.x
          Severity: Major
          Found in lib/mittsu/opengl_implementation/core/geometry.rb and 3 other locations - About 50 mins to fix
          lib/mittsu/opengl_implementation/core/geometry.rb on lines 106..116
          lib/mittsu/opengl_implementation/core/geometry.rb on lines 184..195
          lib/mittsu/opengl_implementation/core/geometry.rb on lines 198..208

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 42.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

                if @colors_need_update
                  @colors.each_with_index do |color, c|
                    offset = c * 3
          
                    @color_array[offset]     = color.r
          Severity: Major
          Found in lib/mittsu/opengl_implementation/core/geometry.rb and 3 other locations - About 50 mins to fix
          lib/mittsu/opengl_implementation/core/geometry.rb on lines 93..103
          lib/mittsu/opengl_implementation/core/geometry.rb on lines 184..195
          lib/mittsu/opengl_implementation/core/geometry.rb on lines 198..208

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 42.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

                if @vertices_need_update
                  @vertices.each_with_index do |vertex, v|
                    offset = v * 3
          
                    @vertex_array[offset]     = vertex.x
          Severity: Major
          Found in lib/mittsu/opengl_implementation/core/geometry.rb and 3 other locations - About 50 mins to fix
          lib/mittsu/opengl_implementation/core/geometry.rb on lines 93..103
          lib/mittsu/opengl_implementation/core/geometry.rb on lines 106..116
          lib/mittsu/opengl_implementation/core/geometry.rb on lines 198..208

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 42.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              def program_info_log
                ptr = ' '*8
                GL.GetProgramiv @program, GL::INFO_LOG_LENGTH, ptr
                length = ptr.unpack('L')[0]
          
          
          Severity: Minor
          Found in lib/mittsu/opengl/program.rb and 1 other location - About 45 mins to fix
          lib/mittsu/opengl/shader.rb on lines 35..45

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 41.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              def shader_info_log
                ptr = ' '*8
                GL.GetShaderiv @shader, GL::INFO_LOG_LENGTH, ptr
                length = ptr.unpack('L')[0]
          
          
          Severity: Minor
          Found in lib/mittsu/opengl/shader.rb and 1 other location - About 45 mins to fix
          lib/mittsu/opengl/program.rb on lines 71..81

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 41.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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

            Severity
            Category
            Status
            Source
            Language