danini-the-panini/mittsu-opengl

View on GitHub

Showing 251 of 251 total issues

Cyclomatic complexity for load_uniforms_generic is too high. [33/6]
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: Minor
Found in lib/mittsu/opengl/renderer.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Method has too many lines. [57/30]
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/opengl/renderer.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [57/30]
Open

    def set(slot, renderer)
      @renderer = renderer

      if image.length == 6
        if needs_update?

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

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/opengl/plugins/shadow_map_plugin.rb - About 4 hrs to fix

    Method has too many lines. [55/30]
    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: Minor
    Found in lib/mittsu/glfw/window.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method has too many lines. [49/30]
    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/opengl/state.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    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/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/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

      Cyclomatic complexity for render is too high. [22/6]
      Open

          def render(scene, camera)
            return unless @renderer.shadow_map_enabled
      
            lights = []
            fog = nil

      This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

      An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

      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/glfw/window.rb - About 3 hrs to fix

        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/opengl_implementation/textures/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 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/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

        Cyclomatic complexity for set_program is too high. [18/6]
        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/opengl/renderer.rb by rubocop

        This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

        An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

        Cyclomatic complexity for initialize is too high. [18/6]
        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: Minor
        Found in lib/mittsu/glfw/window.rb by rubocop

        This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

        An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

        Method has too many lines. [42/30]
        Open

            def program_parameters(lights, fog, object)
              # heuristics to create shader paramaters according to lights in the scene
              # (not to blow over max_lights budget)
        
              max_light_count = allocate_lights(lights)

        This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

        Cyclomatic complexity for set is too high. [17/6]
        Open

            def set(slot, renderer)
              @renderer = renderer
        
              if image.length == 6
                if needs_update?

        This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

        An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

        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/opengl_implementation/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/opengl_implementation/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/opengl/geometry_group.rb - About 2 hrs to fix

            Method has too many lines. [39/30]
            Open

                def setup_buffers
                  return unless @framebuffer.nil?
            
                  # TODO: when OpenGLRenderTargetCube exists
                  is_cube = false # render_target.is_a? OpenGLRenderTargetCube

            This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

            Severity
            Category
            Status
            Source
            Language