danini-the-panini/mittsu

View on GitHub

Showing 659 of 659 total issues

Class has too many lines. [258/250]
Open

  class Geometry
    include OpenGLGeometryLike

    attr_accessor :groups, :initted

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

File geometry.rb has 525 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'securerandom'

module Mittsu
  class Geometry
    include EventDispatcher
Severity: Major
Found in lib/mittsu/core/geometry.rb - About 1 day to fix

    Method set has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
    Open

        def set(slot, renderer)
          @renderer = renderer
    
          if image.length == 6
            if needs_update?
    Severity: Minor
    Found in lib/mittsu/renderers/opengl/textures/cube_texture.rb - About 1 day 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

    File buffer_geometry.rb has 503 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'securerandom'
    require 'mittsu/core/event_dispatcher'
    
    module Mittsu
      class BufferGeometry
    Severity: Major
    Found in lib/mittsu/core/buffer_geometry.rb - About 1 day to fix

      Method has too many lines. [84/30]
      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 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. [80/30]
      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 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. [80/30]
      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: 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 has too many lines. [78/30]
      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 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 a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
      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 - About 6 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 raycast has a Cognitive Complexity of 44 (exceeds 5 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: Minor
      Found in lib/mittsu/objects/line.rb - About 6 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 render has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
      Open

          def render(scene, camera)
            return unless @renderer.shadow_map_enabled
      
            lights = []
            fog = nil
      Severity: Minor
      Found in lib/mittsu/renderers/opengl/plugins/shadow_map_plugin.rb - About 6 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 load_uniforms_generic has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
      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
      
      
      Severity: Minor
      Found in lib/mittsu/renderers/opengl_renderer.rb - About 6 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. [72/30]
      Open

          def set_line_buffers(hint)
            if @vertices_need_update
              @vertices.each_with_index do |vertex, v|
                offset = v * 3
      
      

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

          def set_mesh_buffers(object, hint, should_dispose, material)
            return unless @initted_arrays
      
            geometry = object.geometry
      
      

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

          def init_mesh_buffers(object)
            geometry = object.geometry
      
            nvertices = @faces3.length * 3
            nvertices2 = nvertices * 2

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

          def set_particle_buffers(hint)
            if @vertices_need_update
              @vertices.each_with_index do |vertex, v|
                offset = v * 3
      
      

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

      Class Vector has 42 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class Vector
          attr_accessor :elements, :uv, :index
      
          def initialize(elements)
            @elements = elements
      Severity: Minor
      Found in lib/mittsu/math/vector.rb - About 5 hrs to fix

        Method has too many lines. [64/30]
        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'
        
        

        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