danini-the-panini/mittsu

View on GitHub

Showing 659 of 659 total issues

Cyclomatic complexity for create_material is too high. [40/6]
Open

    def create_material(m, texture_path)
      # defaults

      mtype = 'MeshLambertMaterial'
      mpars = {
Severity: Minor
Found in lib/mittsu/loaders/loader.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. [64/30]
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 if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

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

    def raycast(raycaster, intersects)
      @_inverse_matrix ||= Matrix4.new
      @_ray ||= Ray.new
      @_sphere ||= Sphere.new

Severity: Major
Found in lib/mittsu/objects/mesh.rb - About 5 hrs to fix

    Method has too many lines. [63/30]
    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 if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Class Object3D has 41 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Object3D
        include EventDispatcher
    
        attr_accessor :children, :up, :position, :rotation, :quaternion, :scale, :rotation_auto_update, :matrix, :matrix_world, :matrix_auto_update, :matrix_world_needs_update, :visible, :cast_shadow, :receive_shadow, :frustum_culled, :render_order, :user_data, :parent, :geometry
    
    
    Severity: Minor
    Found in lib/mittsu/core/object_3d.rb - About 5 hrs to fix

      Class Vector3 has 41 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class Vector3 < Vector
          ELEMENTS = { x: 0, y: 1, z: 2 }
          DIMENSIONS = ELEMENTS.count
      
          def initialize(x = 0, y = 0, z = 0)
      Severity: Minor
      Found in lib/mittsu/math/vector3.rb - About 5 hrs to fix

        Method from_buffer_geometry has a Cognitive Complexity of 36 (exceeds 5 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: Minor
        Found in lib/mittsu/core/geometry.rb - About 5 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 create_material has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
        Open

            def create_material(m, texture_path)
              # defaults
        
              mtype = 'MeshLambertMaterial'
              mpars = {
        Severity: Minor
        Found in lib/mittsu/loaders/loader.rb - About 5 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. [60/30]
        Open

            def distance_sq_to_segment(v0, v1, point_on_ray = nil, point_on_segment = nil)
              seg_center = Mittsu::Vector3.new
              seg_dir = Mittsu::Vector3.new
              diff = Mittsu::Vector3.new
              # from http:#www.geometrictools.com/LibMathematics/Distance/Wm5DistRay3Segment3.cpp
        Severity: Minor
        Found in lib/mittsu/math/ray.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. [59/30]
        Open

            def initialize(radius = 100.0, tube = 40.0, radial_segments = 64, tubular_segments = 8, p_val = 2, q_val = 3)
              super()
        
              @type = 'TorusKnotBufferGeometry'
        
        

        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. [59/30]
        Open

            def compute_vertex_normals
              if self[:position]
                positions = self[:position].array
                if self[:normal].nil?
                  self[:normal] = Mittsu::BufferAttribute.new(Array.new(positions.length), 3)
        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.

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

            def compute_tangents
              # based on http:#www.terathon.com/code/tangent.html
              # tangents go to vertices
              tan1 = []; tan2 = [],
              sdir = Mittsu::Vector3.new; tdir = Mittsu::Vector3.new
        Severity: Minor
        Found in lib/mittsu/core/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.

        Class Matrix4 has 38 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class Matrix4
            attr_accessor :elements
        
            DIMENSIONS = 4
        
        
        Severity: Minor
        Found in lib/mittsu/math/matrix4.rb - About 5 hrs to fix

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

              def set(slot, renderer)
                @renderer = renderer
          
                if image.length == 6
                  if needs_update?

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

              def load_uniforms_generic(uniforms)
                uniforms.each do |(uniform, location)|
                  # needs_update property is not added to all uniforms.
                  next if uniform.needs_update == false || location == -1
          
          

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

              def render(scene, camera)
                return unless @renderer.shadow_map_enabled
          
                lights = []
                fog = nil
          Severity: Major
          Found in lib/mittsu/renderers/opengl/plugins/shadow_map_plugin.rb - About 4 hrs to fix

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

                def initialize(func, slices, stacks)
                  super()
            
                  @type = 'ParametricBufferGeometry'
            
            

            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. [55/30]
            Open

                def initialize(width, height, width_segments = 1, height_segments = 1)
                  super()
            
                  @type = 'PlaneBufferGeometry'
            
            

            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. [55/30]
            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 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