danini-the-panini/mittsu

View on GitHub

Showing 659 of 659 total issues

Cyclomatic complexity for compute_offsets is too high. [7/6]
Open

    def compute_offsets(size = 65535)
      # WebGL limits type of index buffer values to 16-bit.
      # TODO: check what the limit is for OpenGL, as we aren't using WebGL here

      indices = self[:index].array
Severity: Minor
Found in lib/mittsu/core/buffer_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 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 compute_tangents is too high. [7/6]
Open

    def compute_tangents
      # based on http://www.terathon.com/code/tangent.html
      # (per vertex tangents)

      if [:index, :position, :normal, :uv].any { |s| !@attributes.has_key?}
Severity: Minor
Found in lib/mittsu/core/buffer_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 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.

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

    def decompose(position, quaternion, scale)
      vector = Mittsu::Vector3.new
      matrix = Mittsu::Matrix4.new
      te = self.elements
      sx = vector.set(te[0], te[1],  te[2]).length
Severity: Minor
Found in lib/mittsu/math/matrix4.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 initialize has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def initialize(vertices, indices, radius = 1.0, detail = 0)
      super()

      @type = 'PolyhedronGeometry'

Severity: Minor
Found in lib/mittsu/extras/geometries/polyhedron_geometry.rb - About 1 hr to fix

    Method initialize has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(func, slices, stacks)
          super()
    
          @type = 'ParametricBufferGeometry'
    
    
    Severity: Minor
    Found in lib/mittsu/extras/geometries/parametric_buffer_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

    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/renderers/opengl/materials/material.rb - About 1 hr to fix

      Method initialize has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def initialize(radius = 100.0, tube = 40.0, radial_segments = 8, tubular_segments = 6, arc = (::Math::PI * 2.0))
            super()
      
            @type = 'TorusGeometry'
      
      
      Severity: Minor
      Found in lib/mittsu/extras/geometries/torus_geometry.rb - About 1 hr to fix

        Method initialize has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def initialize(camera)
              @_vector = Vector3.new
              @_camera = Camera.new
        
              @geometry = Geometry.new
        Severity: Minor
        Found in lib/mittsu/extras/helpers/camera_helper.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/renderers/opengl/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 jsonify has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def jsonify
                children = @children.map(&:to_json)
                {
                  object: {
                    uuid: @uuid,
          Severity: Minor
          Found in lib/mittsu/core/object_3d.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 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/renderers/opengl_render_target.rb - About 1 hr to fix

            Method set_from_euler has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            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 - About 1 hr to fix

              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/renderers/opengl/plugins/shadow_map_plugin.rb - About 1 hr to fix

                Method from_geometry has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                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 - About 1 hr to fix

                  Method slerp has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def slerp(qb, t)
                        return self if t.zero?
                        return self.copy(qb) if t == 1.0
                        _x, _y, _z, _w = @x, @y, @z, @w
                        # http:#www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/
                  Severity: Minor
                  Found in lib/mittsu/math/quaternion.rb - About 1 hr to fix

                    Method subdivide has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def subdivide(face, detail)
                          cols = 2.0 ** detail
                          a = prepare(@vertices[face.a])
                          b = prepare(@vertices[face.b])
                          c = prepare(@vertices[face.c])
                    Severity: Minor
                    Found in lib/mittsu/extras/geometries/polyhedron_geometry.rb - About 1 hr to fix

                      Method merge_vertices has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def merge_vertices
                            vertices_map = {} # Hashmap for looking up vertice by position coordinates (and making sure they are unique)
                            unique = []; changes = []
                            precision_points = 4 # number of decimal points, eg. 4 for epsilon of 0.0001
                            precision = 10 ** precision_points
                      Severity: Minor
                      Found in lib/mittsu/core/geometry.rb - About 1 hr to fix

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

                        Severity
                        Category
                        Status
                        Source
                        Language