Showing 659 of 659 total issues
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)
Method has too many lines. [37/30] 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/
- Read upRead up
- Exclude checks
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.
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 has too many lines. [36/30] Open
def subdivide(face, detail)
cols = 2.0 ** detail
a = prepare(@vertices[face.a])
b = prepare(@vertices[face.b])
c = prepare(@vertices[face.c])
- Read upRead up
- Exclude checks
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 initialize is too high. [12/6] Open
def initialize(radius_top = 20.0, radius_bottom = 20.0, height = 100.0, radial_segments = 8, height_segments = 1, open_ended = false, theta_start = 0.0, theta_length = (::Math::PI * 2.0))
super()
@type = 'CylinderGeometry'
- Read upRead up
- Exclude checks
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 set_particle_buffers is too high. [12/6] Open
def set_particle_buffers(hint)
if @vertices_need_update
@vertices.each_with_index do |vertex, v|
offset = v * 3
- Read upRead up
- Exclude checks
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 distance_sq_to_segment is too high. [12/6] 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
- Read upRead up
- Exclude checks
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 create_texture is too high. [12/6] 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
- Exclude checks
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. [36/30] Open
def merge_vertices
vertices_map = {} # Hashmap for looking up vertice by position coordinates (and making sure they are unique)
unique = []; changes = []
precision_points = 4 # number of decimal points, eg. 4 for epsilon of 0.0001
precision = 10 ** precision_points
- Read upRead up
- Exclude checks
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 convert is too high. [12/6] Open
def convert(materials_info)
return materials_info if !@options
converted = {}
- Read upRead up
- Exclude checks
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 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'
Method compute_tangents
has 59 lines of code (exceeds 25 allowed). Consider refactoring. 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
Method compute_vertex_normals
has 59 lines of code (exceeds 25 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)
File geometry.rb
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'mittsu/renderers/opengl/opengl_geometry_like'
module Mittsu
class Geometry
include OpenGLGeometryLike
Method set_program
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_program(camera, lights, fog, material, object)
@_used_texture_units = 0
if material.needs_update?
deallocate_material(material) if material.program