Showing 659 of 659 total issues
Method compute_tangents
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
def compute_tangents
# based on http://www.terathon.com/code/tangent.html
# (per vertex tangents)
if [:index, :position, :normal, :uv].any { |s| !@attributes.has_key?}
Method has too many lines. [53/30] Open
def build_plane(u, v, udir, vdir, width, height, depth, material_index)
grid_x = @width_segments
grid_y = @height_segments
width_half = width / 2.0
height_half = height / 2.0
- 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.
Method distance_sq_to_segment
has a Cognitive Complexity of 29 (exceeds 5 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
- 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 has too many lines. [52/30] Open
def initialize(points, segments = 12, phi_start = 0.0, phi_length = (::Math::PI * 2.0))
super()
@type = 'LatheGeometry'
- 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 raycast is too high. [28/6] Open
def raycast(raycaster, intersects)
@_inverse_matrix ||= Matrix4.new
@_ray ||= Ray.new
@_sphere ||= Sphere.new
- 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 100 lines of code (exceeds 25 allowed). Consider refactoring. 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'
Method set_from_rotation_matrix
has a Cognitive Complexity of 27 (exceeds 5 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]
- 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 has too many lines. [49/30] 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)
- 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.
Method load_uniforms_generic
has 97 lines of code (exceeds 25 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
Method set_program
has a Cognitive Complexity of 26 (exceeds 5 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
- 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 has too many lines. [47/30] Open
def raycast(raycaster, intersects)
threshold = raycaster.params[:point_cloud][:threshold]
@_inverse_matrix.inverse(self.matrix_world)
@_ray.copy(raycaster.ray).apply_matrix4(@_inverse_matrix)
- 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.
Method has too many lines. [47/30] Open
def compute_morph_normals
# save original normals
# - create temp variables on first access
# otherwise just copy (for faster repeated calls)
@_original_face_normal ||= []
- 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.
Method convert
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def convert(materials_info)
return materials_info if !@options
converted = {}
- 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 has too many lines. [46/30] 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
- 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 render is too high. [22/6] Open
def render(scene, camera)
return unless @renderer.shadow_map_enabled
lights = []
fog = nil
- 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. [45/30] 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))
super()
@type = 'RingGeometry'
- 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.
Method create_material
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_material(m, texture_path)
# defaults
mtype = 'MeshLambertMaterial'
mpars = {
Class Window
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Window
attr_accessor :key_press_handler, :key_release_handler, :key_repeat_handler, :char_input_handler, :cursor_pos_handler, :mouse_button_press_handler, :mouse_button_release_handler, :scroll_handler, :framebuffer_size_handler
def initialize(width, height, title, antialias: 0)
::GLFW.Init
Method has too many lines. [44/30] Open
def initialize(vertices, indices, radius = 1.0, detail = 0)
super()
@type = 'PolyhedronGeometry'
- 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 object_3d.rb
has 303 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'securerandom'
module Mittsu
class Object3D
include EventDispatcher