danini-the-panini/mittsu-opengl

View on GitHub

Showing 251 of 251 total issues

Cyclomatic complexity for init_custom_attributes is too high. [8/6]
Open

    def init_custom_attributes(object)
      material = object.material

      nvertices = @vertices.length

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

    def update
      # TODO: GL.BindVertexArray ???
      material = buffer_material(geometry)
      custom_attributes_dirty = material.attributes && material.custom_attributes_dirty?

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

    def init
      if !@initted
        puts " --- INIT #{self.name}" if DEBUG

        @initted = true

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

    def update_shadow_camera(camera, light)
      shadow_camera = light.shadow_camera
      points_frustum = light.pointa_frustum
      points_world = light.points_world

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

    def render(scene, camera, render_target = default_target, force_clear = false)
      raise "ERROR: Mittsu::OpenGL::Renderer#render: camera is not an instance of Mittsu::Camera" unless camera.is_a?(Camera)

      reset_cache_for_this_frame

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

    def project(renderer)
      puts " --- PROJECT #{self.name}" if DEBUG
      @renderer = renderer
      return unless visible
      init

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 fire_joystick_button_event is too high. [7/6]
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 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 program_parameters has 42 lines of code (exceeds 25 allowed). Consider refactoring.
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)
Severity: Minor
Found in lib/mittsu/opengl_implementation/materials/material.rb - About 1 hr to fix

    Method set_blending has a Cognitive Complexity of 13 (exceeds 5 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

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

        def initialize(renderer, lights, opengl_objects, opengl_objects_immediate)
          @renderer, @lights = renderer, lights
          @opengl_objects = opengl_objects
          @opengl_objects_immediate = opengl_objects_immediate
    
    
    Severity: Minor
    Found in lib/mittsu/opengl/plugins/shadow_map_plugin.rb - About 1 hr to fix

      Method setup_buffers has 39 lines of code (exceeds 25 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 1 hr to fix

        Method update_shadow_camera has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def update_shadow_camera(camera, light)
              shadow_camera = light.shadow_camera
              points_frustum = light.pointa_frustum
              points_world = light.points_world
        
        
        Severity: Minor
        Found in lib/mittsu/opengl/plugins/shadow_map_plugin.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 set_line_buffers has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

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

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

              if geometry.uvs_need_update && obj_uvs
                @faces3.each do |fi|
                  uv = obj_uvs[fi]
        
                  next if uv.nil?
        Severity: Major
        Found in lib/mittsu/opengl/geometry_group.rb and 1 other location - About 1 hr to fix
        lib/mittsu/opengl/geometry_group.rb on lines 470..490

        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 60.

        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 unroll_buffer_material has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def unroll_buffer_material(opengl_object)
              object = opengl_object.object
              buffer = opengl_object.buffer
        
              geometry = object.geometry
        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 make_groups has a Cognitive Complexity of 12 (exceeds 5 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

        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

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

              if geometry.uvs_need_update && obj_uvs2
                @faces3.each do |fi|
                  uv2 = obj_uvs2[fi]
        
                  next if uv2.nil?
        Severity: Major
        Found in lib/mittsu/opengl/geometry_group.rb and 1 other location - About 1 hr to fix
        lib/mittsu/opengl/geometry_group.rb on lines 448..468

        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 60.

        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

        Consider simplifying this complex logical expression.
        Open

                if geometry.vertices_need_update || geometry.morph_targets_need_update || geometry.elements_need_update || geometry.uvs_need_update || geometry.normals_need_update || geometry.colors_need_update || geometry.tangents_need_update || custom_attributes_dirty
                  geometry_group.set_mesh_buffers(self, GL::DYNAMIC_DRAW, !geometry.dynamic, mat)
                end
        Severity: Critical
        Found in lib/mittsu/opengl_implementation/objects/mesh.rb - About 1 hr to fix

          Method create_virtual_light has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def create_virtual_light(light, cascade)
                DirectionalLight.new.tap do |virtual_light|
                  virtual_light.is_virtual = true
          
                  virtual_light.only_shadow = true
          Severity: Minor
          Found in lib/mittsu/opengl/plugins/shadow_map_plugin.rb - About 1 hr to fix

            Method load_uniforms has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                    def load_uniforms(uniforms, uniforms_lib)
                      uniform_strings = nil;
                      in_uniform = false
                
                      uniforms.lines.map(&:strip).each_with_object({}) { |line, hash|
            Severity: Minor
            Found in lib/mittsu/opengl/shader/rbsl_loader.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

            Severity
            Category
            Status
            Source
            Language