Showing 226 of 659 total issues
Method intersects_box?
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def intersects_box?(box)
p1 = Mittsu::Vector3.new
p2 = Mittsu::Vector3.new
planes = self.planes
6.times do |i|
- Read upRead up
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 set_particle_buffers
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def set_particle_buffers(hint)
if @vertices_need_update
@vertices.each_with_index do |vertex, v|
offset = v * 3
- Read upRead up
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 set_line_buffers
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_line_buffers(hint)
if @vertices_need_update
@vertices.each_with_index do |vertex, v|
offset = v * 3
Method init_mesh_buffers
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
def init_mesh_buffers(object)
geometry = object.geometry
nvertices = @faces3.length * 3
nvertices2 = nvertices * 2
Method create_texture
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. 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)
- Read upRead up
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 20 (exceeds 5 allowed). Consider refactoring. Open
def merge(geometry, matrix = nil, material_index_offset = nil)
if !geometry.is_a? Mittsu::Geometry
puts('ERROR: Mittsu::Geometry#merge: geometry not an instance of Mittsu::Geometry.', geometry.inspect)
return
end
- Read upRead up
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 set_axis_angle_from_rotation_matrix
has 67 lines of code (exceeds 25 allowed). Consider refactoring. 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
Method set_particle_buffers
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_particle_buffers(hint)
if @vertices_need_update
@vertices.each_with_index do |vertex, v|
offset = v * 3
Method set_from_rotation_matrix
has 65 lines of code (exceeds 25 allowed). Consider refactoring. 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]
Method set_axis_angle_from_rotation_matrix
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. 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
- Read upRead up
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 64 lines of code (exceeds 25 allowed). Consider refactoring. 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'
Method from_buffer_geometry
has 64 lines of code (exceeds 25 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
Method compute_offsets
has 63 lines of code (exceeds 25 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
Class OBJLoader
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class OBJLoader
include EventDispatcher
FLOAT = /[\d|.|+|\-|e]+/
Class Box2
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Box2
attr_accessor :min, :max
def initialize(min = nil, max = nil)
@min = min || Mittsu::Vector2.new(Float::INFINITY, Float::INFINITY)
File shadow_map_plugin.rb
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'mittsu/math'
require 'mittsu/renderers/opengl_render_target'
module Mittsu
class ShadowMapPlugin
File quaternion.rb
has 268 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Mittsu
class Quaternion
EPS = 0.000001
attr_reader :x, :y, :z, :w
Method parse
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def parse(text)
lines = text.split("\n")
info = {}
delimiter_pattern = /\s+/
materials_info = {}
- Read upRead up
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 distance_sq_to_segment
has 60 lines of code (exceeds 25 allowed). Consider refactoring. 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
Method initialize
has 59 lines of code (exceeds 25 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'