danini-the-panini/mittsu

View on GitHub

Showing 659 of 659 total issues

Method slerp has a Cognitive Complexity of 6 (exceeds 5 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 25 mins 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

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

      @type = 'TorusKnotBufferGeometry'

Severity: Minor
Found in lib/mittsu/extras/geometries/torus_knot_buffer_geometry.rb - About 25 mins 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 project_object has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def project_object(scene, object, shadow_camera)
      if object.visible
        opengl_objects = @opengl_objects[object.id]

        if opengl_objects && object.cast_shadow && (object.frustum_culled == false || @frustum.intersects_object?(object) == true)
Severity: Minor
Found in lib/mittsu/renderers/opengl/plugins/shadow_map_plugin.rb - About 25 mins 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 call_debug_method has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def call_debug_method m, called_from = caller[0], *args
      if m.to_s.start_with?('Uniform')
        uniform_name = @@current_shader.get_uniform_name(args.first)
        call = "#{m}('#{uniform_name}',#{args[1..-1].map { |s| s.to_s[0..20] }.join(', ')})"
      else
Severity: Minor
Found in lib/mittsu/renderers/opengl/opengl_debug.rb - About 25 mins 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 make_rotation_from_euler has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
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 - About 25 mins 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 point has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def point(k)
      point = (@points.length - 1) * k
      int_point = point.floor
      weight = point - int_point

Severity: Minor
Found in lib/mittsu/math/spline.rb - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
Open

    def merge(geometry, offset = 0)
      if !geometry.is_a? Mittsu::BufferGeometry
        puts "ERROR: Mittsu::BufferGeometry#merge: geometry not an instance of Mittsu::BufferGeometry. #{geometry.inspect}"
        return
      end
Severity: Minor
Found in lib/mittsu/core/buffer_geometry.rb - About 25 mins 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        if has_face_vertex_normal
          vertex_normals = face.vertex_normals
          faces << get_normal_index(vertex_normals[0], normals_hash, normals)
          faces << get_normal_index(vertex_normals[1], normals_hash, normals)
          faces << get_normal_index(vertex_normals[2], normals_hash, normals)
Severity: Minor
Found in lib/mittsu/core/geometry.rb and 1 other location - About 25 mins to fix
lib/mittsu/core/geometry.rb on lines 521..525

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 30.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        if has_face_vertex_color
          vertex_colors = face.vertex_colors
          faces << get_color_index(vertex_colors[0], colors_hash, colors)
          faces << get_color_index(vertex_colors[1], colors_hash, colors)
          faces << get_color_index(vertex_colors[2], colors_hash, colors)
Severity: Minor
Found in lib/mittsu/core/geometry.rb and 1 other location - About 25 mins to fix
lib/mittsu/core/geometry.rb on lines 512..516

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 30.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method compute_bounding_box has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def compute_bounding_box
      vector = Mittsu::Vector3.new

      @bounding_box ||= Mittsu::Box3.new

Severity: Minor
Found in lib/mittsu/core/buffer_geometry.rb - About 25 mins 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 update_matrix_world has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def update_matrix_world(force = false)
      self.update_matrix if @matrix_auto_update
      if @matrix_world_needs_update || force
        if @parent.nil?
          @matrix_world.copy(@matrix)
Severity: Minor
Found in lib/mittsu/core/object_3d.rb - About 25 mins 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 parse_ascii_facet has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
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 - About 25 mins 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

Avoid parameter lists longer than 5 parameters. [6/5]
Open

    def initialize(left, right, top, bottom, near = 0.1, far = 2000.0)

This cop checks for methods with too many parameters. The maximum number of parameters is configurable. Keyword arguments can optionally be excluded from the total count.

Avoid parameter lists longer than 5 parameters. [6/5]
Open

    def initialize(radius = 100.0, tube = 40.0, radial_segments = 64, tubular_segments = 8, p_val = 2, q_val = 3)

This cop checks for methods with too many parameters. The maximum number of parameters is configurable. Keyword arguments can optionally be excluded from the total count.

Avoid parameter lists longer than 5 parameters. [6/5]
Open

    def initialize(width, height, depth, width_segments = nil, height_segments = nil, depth_segments = nil)

This cop checks for methods with too many parameters. The maximum number of parameters is configurable. Keyword arguments can optionally be excluded from the total count.

Avoid parameter lists longer than 5 parameters. [6/5]
Open

    def set_view_offset(full_width, full_height, x, y, width, height)

This cop checks for methods with too many parameters. The maximum number of parameters is configurable. Keyword arguments can optionally be excluded from the total count.

Avoid parameter lists longer than 5 parameters. [6/5]
Open

    def initialize(radius = 100.0, tube = 40.0, radial_segments = 64, tubular_segments = 8, p_val = 2, q_val = 3)

This cop checks for methods with too many parameters. The maximum number of parameters is configurable. Keyword arguments can optionally be excluded from the total count.

Avoid parameter lists longer than 5 parameters. [6/5]
Open

    def initialize(color = nil, intensity = 1.0, distance = 0.0, angle = (::Math::PI / 3.0), exponent = 10.0, decay = 1.0)
Severity: Minor
Found in lib/mittsu/lights/spot_light.rb by rubocop

This cop checks for methods with too many parameters. The maximum number of parameters is configurable. Keyword arguments can optionally be excluded from the total count.

Avoid parameter lists longer than 5 parameters. [6/5]
Open

    def initialize(inner_radius = 0.0, outer_radius = 50.0, theta_segments = 8, phi_segments = 8, theta_start = 0.0, theta_length = (::Math::PI * 2.0))

This cop checks for methods with too many parameters. The maximum number of parameters is configurable. Keyword arguments can optionally be excluded from the total count.

Avoid parameter lists longer than 5 parameters. [6/5]
Open

    def render_buffer(camera, lights, fog, material, geometry_group, update_buffers)

This cop checks for methods with too many parameters. The maximum number of parameters is configurable. Keyword arguments can optionally be excluded from the total count.

Severity
Category
Status
Source
Language