danini-the-panini/mittsu-opengl

View on GitHub

Showing 251 of 251 total issues

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

    def initialize(renderer, lights, opengl_objects, opengl_objects_immediate)
      @renderer, @lights = renderer, lights
      @opengl_objects = opengl_objects
      @opengl_objects_immediate = opengl_objects_immediate

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 set_particle_buffers has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def set_particle_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

    Cyclomatic complexity for set_blending is too high. [14/6]
    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 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 setup_buffers is too high. [14/6]
    Open

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

    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 init_mesh_buffers is too high. [14/6]
    Open

        def init_mesh_buffers(object)
          geometry = object.geometry
    
          nvertices = @faces3.length * 3
          nvertices2 = nvertices * 2
    Severity: Minor
    Found in lib/mittsu/opengl/geometry_group.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.

    File shadow_map_plugin.rb has 268 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'mittsu/math'
    
    module Mittsu
      class ShadowMapPlugin
        def initialize(renderer, lights, opengl_objects, opengl_objects_immediate)
    Severity: Minor
    Found in lib/mittsu/opengl/plugins/shadow_map_plugin.rb - About 2 hrs to fix

      Cyclomatic complexity for set_particle_buffers is too high. [12/6]
      Open

          def set_particle_buffers(hint)
            if @vertices_need_update
              @vertices.each_with_index do |vertex, v|
                offset = v * 3
      
      

      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.

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

      require 'mittsu/opengl/geometry_like'
      
      module Mittsu
        class Geometry
          include OpenGL::GeometryLike
      Severity: Minor
      Found in lib/mittsu/opengl_implementation/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/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/opengl_implementation/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/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

            Cyclomatic complexity for update is too high. [11/6]
            Open

                def update
                  # check all geometry groubs
                  mat = nil
                  geometry.groups.each do |geometry_group|
                    # TODO: place to put this???

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

              Cyclomatic complexity for set_line_buffers is too high. [10/6]
              Open

                  def set_line_buffers(hint)
                    if @vertices_need_update
                      @vertices.each_with_index do |vertex, v|
                        offset = v * 3
              
              

              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 render_buffer is too high. [10/6]
              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 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 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/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_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/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

              Cyclomatic complexity for update_object is too high. [9/6]
              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 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. [33/30]
              Open

                  def create_virtual_light(light, cascade)
                    DirectionalLight.new.tap do |virtual_light|
                      virtual_light.is_virtual = true
              
                      virtual_light.only_shadow = true

              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 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/opengl/state.rb - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language