danini-the-panini/mittsu

View on GitHub

Showing 659 of 659 total issues

Method make_rotation_from_euler has 80 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def make_rotation_from_euler(euler)
      te = self.elements
      x, y, z = euler.x, euler.y, euler.z
      a, b = ::Math.cos(x), ::Math.sin(x)
      c, d = ::Math.cos(y), ::Math.sin(y)
Severity: Major
Found in lib/mittsu/math/matrix4.rb - About 3 hrs to fix

    Method raycast has 80 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def raycast(raycaster, intersects)
          precision = raycaster.line_precision
          precision_sq = precision * precision
    
          @geometry.compute_bounding_sphere if @geometry.bounding_sphere.nil?
    Severity: Major
    Found in lib/mittsu/objects/line.rb - About 3 hrs to fix

      Class Quaternion has 27 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class Quaternion
          EPS = 0.000001
      
          attr_reader :x, :y, :z, :w
      
      
      Severity: Minor
      Found in lib/mittsu/math/quaternion.rb - About 3 hrs to fix

        Method to_json has 78 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def to_json
              output = {
                metadata: {
                  version: 4.0,
                  type: 'BufferGeometry',
        Severity: Major
        Found in lib/mittsu/core/geometry.rb - About 3 hrs to fix

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

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

              def to_json
                output = {
                  metadata: {
                    version: 4.0,
                    type: 'BufferGeometry',
          Severity: Minor
          Found in lib/mittsu/core/geometry.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 has too many lines. [42/30]
          Open

              def initialize(radius = 100.0, tube = 40.0, radial_segments = 8, tubular_segments = 6, arc = (::Math::PI * 2.0))
                super()
          
                @type = 'TorusGeometry'
          
          

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

              def intersect_box(box, target = Mittsu::Vector3.new)
                # http:#www.scratchapixel.com/lessons/3d-basic-lessons/lesson-7-intersecting-simple-shapes/ray-box-intersection/
                invdirx = 1.0 / @direction.x
                invdiry = 1.0 / @direction.y
                invdirz = 1.0 / @direction.z
          Severity: Minor
          Found in lib/mittsu/math/ray.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/renderers/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.

          Cyclomatic complexity for from_buffer_geometry is too high. [18/6]
          Open

              def from_buffer_geometry(geometry)
                scope = self
                vertices = geometry[:position].array
                indices = geometry[:index].nil? ? nil : geometry[:index].array
                normals = geometry[:normal].nil? ? nil : geometry[:normal].array
          Severity: Minor
          Found in lib/mittsu/core/geometry.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 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
          
          

          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 Box3 has 26 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class Box3
              attr_accessor :min, :max
          
              def initialize(min = nil, max = nil)
                @min = min || Mittsu::Vector3.new(Float::INFINITY, Float::INFINITY, Float::INFINITY)
          Severity: Minor
          Found in lib/mittsu/math/box3.rb - About 3 hrs to fix

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

                def raycast(raycaster, intersects)
                  precision = raycaster.line_precision
                  precision_sq = precision * precision
            
                  @geometry.compute_bounding_sphere if @geometry.bounding_sphere.nil?
            Severity: Minor
            Found in lib/mittsu/objects/line.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 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 intersects_box? has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                def intersects_box?(box)
                  p1 = Mittsu::Vector3.new
                  p2 = Mittsu::Vector3.new
                  planes = self.planes
                  6.times do |i|
            Severity: Minor
            Found in lib/mittsu/math/frustum.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_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/renderers/opengl/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/renderers/opengl/core/geometry.rb - About 2 hrs to fix

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

                  def initialize(camera)
                    @_vector = Vector3.new
                    @_camera = Camera.new
              
                    @geometry = Geometry.new

              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