danini-the-panini/mittsu

View on GitHub

Showing 659 of 659 total issues

Method initialize has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def initialize(radius_top = 20.0, radius_bottom = 20.0, height = 100.0, radial_segments = 8, height_segments = 1, open_ended = false, theta_start = 0.0, theta_length = (::Math::PI * 2.0))
Severity: Major
Found in lib/mittsu/extras/geometries/cylinder_geometry.rb - About 1 hr to fix

    Method build_plane has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def build_plane(u, v, udir, vdir, width, height, depth, material_index)
    Severity: Major
    Found in lib/mittsu/extras/geometries/box_geometry.rb - About 1 hr to fix

      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/renderers/opengl/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 intersect_triangle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def intersect_triangle(a, b, c, backface_culling, target = Mittsu::Vector3.new)
            # Compute the offset origin, edges, and normal.
            diff = Mittsu::Vector3.new
            edge1 = Mittsu::Vector3.new
            edge2 = Mittsu::Vector3.new
      Severity: Minor
      Found in lib/mittsu/math/ray.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/renderers/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 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/renderers/opengl/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 print_tree has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def print_tree(lines=[])
            if lines.empty?
              puts self
            else
              last = !lines.last
      Severity: Minor
      Found in lib/mittsu/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 create_material has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def create_material(material_name)
              mat = @materials_info[material_name]
              params = {
                name: material_name,
                side: @side
      Severity: Minor
      Found in lib/mittsu/loaders/mtl_loader.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 load has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def load(url, mtlurl = nil)
            object = OBJLoader.new(@manager).load(url)
      
            if !mtlurl.nil?
              mtl_loader = MTLLoader.new(File.dirname(url))
      Severity: Minor
      Found in lib/mittsu/loaders/obj_mtl_loader.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 check_intersection has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def check_intersection object, raycaster, ray, pA, pB, pC, point
      Severity: Major
      Found in lib/mittsu/objects/mesh.rb - About 50 mins to fix

        Method initialize has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def initialize(radius = 50.0, width_segments = 8, height_segments = 6, phi_start = 0.0, phi_length = (::Math::PI * 2.0), theta_start = 0.0, theta_length = ::Math::PI)
        Severity: Major
        Found in lib/mittsu/extras/geometries/sphere_geometry.rb - About 50 mins to fix

          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/renderers/opengl/opengl_state.rb - About 50 mins to fix

            Method interpolate has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def interpolate(p0, p1, p2, p3, t, t2, t3)
            Severity: Major
            Found in lib/mittsu/math/spline.rb - About 50 mins to fix

              Method create_texture has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def create_texture(where, name, source_file, repeat, offset, wrap, anisotropy)
              Severity: Major
              Found in lib/mittsu/loaders/loader.rb - About 50 mins to fix

                Avoid parameter lists longer than 5 parameters. [11/5]
                Open

                    def initialize(data = nil, width = nil, height = nil, format = RGBAFormat, type = UnsignedByteType, mapping = DEFAULT_MAPPING, wrap_s = ClampToEdgeWrapping, wrap_t = ClampToEdgeWrapping, mag_filter = LinearFilter, min_filter = LinearMipMapLinearFilter, anisotropy = 1)
                Severity: Minor
                Found in lib/mittsu/textures/data_texture.rb by rubocop

                This cop checks for methods with too many parameters. The maximum number of parameters is configurable. Keyword arguments can optionally be excluded from the total count.

                Avoid parameter lists longer than 5 parameters. [11/5]
                Open

                    def initialize(mipmaps = nil, width = nil, height = nil, format = RGBAFormat, type = UnsignedByteType, mapping = DEFAULT_MAPPING, wrap_s = ClampToEdgeWrapping, wrap_t = ClampToEdgeWrapping, mag_filter = LinearFilter, min_filter = LinearMipMapLinearFilter, anisotropy = 1)

                This cop checks for methods with too many parameters. The maximum number of parameters is configurable. Keyword arguments can optionally be excluded from the total count.

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

                      if invdirx >= 0
                        tmin = (box.min.x - origin.x) * invdirx
                        tmax = (box.max.x - origin.x) * invdirx
                      else
                        tmin = (box.max.x - origin.x) * invdirx
                Severity: Major
                Found in lib/mittsu/math/ray.rb and 2 other locations - About 50 mins to fix
                lib/mittsu/math/ray.rb on lines 203..208
                lib/mittsu/math/ray.rb on lines 215..220

                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/renderers/opengl/core/geometry.rb and 3 other locations - About 50 mins to fix
                lib/mittsu/renderers/opengl/core/geometry.rb on lines 106..116
                lib/mittsu/renderers/opengl/core/geometry.rb on lines 184..195
                lib/mittsu/renderers/opengl/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/renderers/opengl/core/geometry.rb and 3 other locations - About 50 mins to fix
                lib/mittsu/renderers/opengl/core/geometry.rb on lines 93..103
                lib/mittsu/renderers/opengl/core/geometry.rb on lines 106..116
                lib/mittsu/renderers/opengl/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/renderers/opengl/core/geometry.rb and 3 other locations - About 50 mins to fix
                lib/mittsu/renderers/opengl/core/geometry.rb on lines 93..103
                lib/mittsu/renderers/opengl/core/geometry.rb on lines 106..116
                lib/mittsu/renderers/opengl/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

                Severity
                Category
                Status
                Source
                Language