danini-the-panini/mittsu

View on GitHub

Showing 659 of 659 total issues

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

    Method create_texture has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        def create_texture(where, name, source_file, repeat, offset, wrap, anisotropy)
          full_path = File.join(texture_path, source_file)
    
          loader = Handlers.get(full_path)
    
    
    Severity: Minor
    Found in lib/mittsu/loaders/loader.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 merge has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        def merge(geometry, matrix = nil, material_index_offset = nil)
          if !geometry.is_a? Mittsu::Geometry
            puts('ERROR: Mittsu::Geometry#merge: geometry not an instance of Mittsu::Geometry.', geometry.inspect)
            return
          end
    Severity: Minor
    Found in lib/mittsu/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 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.

    Cyclomatic complexity for set_axis_angle_from_rotation_matrix is too high. [15/6]
    Open

        def set_axis_angle_from_rotation_matrix(m)
          # http:#www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm
          # assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
          angle, x1, y1, z1 = nil    # variables for result
          epsilon = 0.01    # margin to allow for rounding errors
    Severity: Minor
    Found in lib/mittsu/math/vector4.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_from_rotation_matrix is too high. [15/6]
    Open

        def set_from_rotation_matrix(m, order, update = true)
          # assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
          te = m.elements
          m11 = te[0]; m12 = te[4]; m13 = te[8]
          m21 = te[1]; m22 = te[5]; m23 = te[9]
    Severity: Minor
    Found in lib/mittsu/math/euler.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. [39/30]
    Open

        def set_from_euler(euler, update = true)
          # http:#www.mathworks.com/matlabcentral/fileexchange/
          #   20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/
          #  content/SpinCalc.m
          c1 = ::Math.cos(euler.x / 2.0)
    Severity: Minor
    Found in lib/mittsu/math/quaternion.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. [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_axis_angle_from_rotation_matrix has 67 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def set_axis_angle_from_rotation_matrix(m)
          # http:#www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm
          # assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
          angle, x1, y1, z1 = nil    # variables for result
          epsilon = 0.01    # margin to allow for rounding errors
    Severity: Major
    Found in lib/mittsu/math/vector4.rb - About 2 hrs to fix

      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/renderers/opengl/core/geometry.rb - About 2 hrs to fix

        Method set_from_rotation_matrix has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def set_from_rotation_matrix(m, order, update = true)
              # assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
              te = m.elements
              m11 = te[0]; m12 = te[4]; m13 = te[8]
              m21 = te[1]; m22 = te[5]; m23 = te[9]
        Severity: Major
        Found in lib/mittsu/math/euler.rb - About 2 hrs to fix

          Cyclomatic complexity for build_plane is too high. [14/6]
          Open

              def build_plane(u, v, udir, vdir, width, height, depth, material_index)
                grid_x = @width_segments
                grid_y = @height_segments
                width_half = width / 2.0
                height_half = height / 2.0

          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

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

              def to_json
                output = {
                  metadata: {
                    version: 4.0,
                    type: 'BufferGeometry',
          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.

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

              def from_geometry(geometry, settings = {})
                vertices = geometry.vertices
                faces = geometry.faces
                face_vertex_uvs = geometry.face_vertex_uvs
                vertex_colors = settings.fetch(:vertex_colors, Mittsu::NoColors)
          Severity: Minor
          Found in lib/mittsu/core/buffer_geometry.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.

          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)

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

              def set_axis_angle_from_rotation_matrix(m)
                # http:#www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm
                # assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
                angle, x1, y1, z1 = nil    # variables for result
                epsilon = 0.01    # margin to allow for rounding errors
          Severity: Minor
          Found in lib/mittsu/math/vector4.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 initialize has 64 lines of code (exceeds 25 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)
                super()
          
                @type = 'SphereGeometry'
          
          
          Severity: Major
          Found in lib/mittsu/extras/geometries/sphere_geometry.rb - About 2 hrs to fix

            Method from_buffer_geometry has 64 lines of code (exceeds 25 allowed). Consider refactoring.
            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: Major
            Found in lib/mittsu/core/geometry.rb - About 2 hrs to fix
              Severity
              Category
              Status
              Source
              Language