Method has too many lines. [120/30] Open
def render(scene, camera)
return unless @renderer.shadow_map_enabled
lights = []
fog = nil
- 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.
Class has too many lines. [263/250] Open
class ShadowMapPlugin
def initialize(renderer, lights, opengl_objects, opengl_objects_immediate)
@renderer, @lights = renderer, lights
@opengl_objects = opengl_objects
@opengl_objects_immediate = opengl_objects_immediate
- Read upRead up
- Exclude checks
This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method render
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
def render(scene, camera)
return unless @renderer.shadow_map_enabled
lights = []
fog = nil
- 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 render
has 120 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render(scene, camera)
return unless @renderer.shadow_map_enabled
lights = []
fog = nil
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. [39/30] Open
def initialize(renderer, lights, opengl_objects, opengl_objects_immediate)
@renderer, @lights = renderer, lights
@opengl_objects = opengl_objects
@opengl_objects_immediate = opengl_objects_immediate
- 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 268 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'mittsu/math'
module Mittsu
class ShadowMapPlugin
def initialize(renderer, lights, opengl_objects, opengl_objects_immediate)
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
- 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 update_shadow_camera is too high. [7/6] Open
def update_shadow_camera(camera, light)
shadow_camera = light.shadow_camera
points_frustum = light.pointa_frustum
points_world = light.points_world
- 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 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(renderer, lights, opengl_objects, opengl_objects_immediate)
@renderer, @lights = renderer, lights
@opengl_objects = opengl_objects
@opengl_objects_immediate = opengl_objects_immediate
Method update_shadow_camera
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def update_shadow_camera(camera, light)
shadow_camera = light.shadow_camera
points_frustum = light.pointa_frustum
points_world = light.points_world
- 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 create_virtual_light
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_virtual_light(light, cascade)
DirectionalLight.new.tap do |virtual_light|
virtual_light.is_virtual = true
virtual_light.only_shadow = true
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)
- 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
TODO found Open
# TODO: SkinnedMesh/morph_targets
- Exclude checks
TODO found Open
# TODO: SkinnedMesh/morph_targets
- Exclude checks
Use ==
if you meant to do a comparison or wrap the expression in parentheses to indicate you meant to assign in a condition. Open
if @renderer.shadow_map_cull_face = CullFaceFront
- Read upRead up
- Exclude checks
This cop checks for assignments in the conditions of if/while/until.
Example:
# bad
if some_var = true
do_something
end
Example:
# good
if some_var == true
do_something
end