danini-the-panini/mittsu

View on GitHub

Showing 659 of 659 total issues

Method compute_offsets has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
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 - 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 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def initialize(points, segments = 12, phi_start = 0.0, phi_length = (::Math::PI * 2.0))
      super()

      @type = 'LatheGeometry'

Severity: Major
Found in lib/mittsu/extras/geometries/lathe_geometry.rb - About 2 hrs to fix

    Cyclomatic complexity for update_object is too high. [9/6]
    Open

        def update_object(object)
          geometry = object.geometry
    
          if geometry.is_a? BufferGeometry
            # TODO: geometry vertex array ?????

    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. [9/6]
    Open

        def initialize(vertices, indices, radius = 1.0, detail = 0)
          super()
    
          @type = 'PolyhedronGeometry'
    
    

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

        def create_virtual_light(light, cascade)
          DirectionalLight.new.tap do |virtual_light|
            virtual_light.is_virtual = true
    
            virtual_light.only_shadow = true

    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. [33/30]
    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 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 intersects_box? is too high. [9/6]
    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 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. [33/30]
    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 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. [33/30]
    Open

        def to_json
          output = {
            metadata: {
              version: 4.0,
              type: 'BufferGeometry',
    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 set has 16 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def set(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44)
    Severity: Major
    Found in lib/mittsu/math/matrix4.rb - About 2 hrs to fix

      Method set_blending has 49 lines of code (exceeds 25 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

        Method initialize has a Cognitive Complexity of 15 (exceeds 5 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

        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 subdivide has a Cognitive Complexity of 15 (exceeds 5 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

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

        Cyclomatic complexity for subdivide is too high. [8/6]
        Open

            def subdivide(face, detail)
              cols = 2.0 ** detail
              a = prepare(@vertices[face.a])
              b = prepare(@vertices[face.b])
              c = prepare(@vertices[face.c])

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

            def intersect_triangle(a, b, c, backface_culling, target = Mittsu::Vector3.new)
              # Compute the offset origin, edges, and normal.
              diff = Mittsu::Vector3.new
              edge1 = Mittsu::Vector3.new
              edge2 = Mittsu::Vector3.new
        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.

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

            def set_from_rotation_matrix(m)
              # http:#www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm
              # 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]
        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.

        Cyclomatic complexity for parse_ascii_facet is too high. [8/6]
        Open

            def parse_ascii_facet(line, stream)
              vertices = []
              normal = nil
              if line.match NORMAL_PATTERN
                normal = Vector3.new($1, $2, $3)
        Severity: Minor
        Found in lib/mittsu/loaders/stl_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. [32/30]
        Open

            def initialize(parameters = {})
              super()
        
                @type = 'MeshPhongMaterial'
        
        

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

            def init_custom_attributes(object)
              material = object.material
        
              nvertices = @vertices.length
        
        

        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.

        Severity
        Category
        Status
        Source
        Language