Showing 160 of 250 total issues
Method join_fragment_shader_snippet_stack
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def join_fragment_shader_snippet_stack(uniforms, snippets, objects)
return FRAGMENT_SHADER_STUB if snippets.empty?
#
# Source code for uniforms declarations at top of shader scripts
- 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 tick_animations!
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def tick_animations!
delete_if { |animation|
# Floating point value animation
progress = ($env[:frame_time] - animation.begin_time) / (animation.end_time - animation.begin_time)
if animation.end_value.is_a? Float
Method on_key_press
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def on_key_press(key)
if key.control?
if key == 'd'
clone_selected
elsif key == 'e'
Method generate_character_image
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate_character_image(font, character)
puts "generating #{font} #{character}"
image = Image.new
@canvas.using { |context|
Method tick
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def tick
director.one { |dmx_director|
lights = dmx_director.effects
actor.one { |actor_effects|
with_env(:total_children, lights.size) { # this can have an effect on the resulting color set
Method create!
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create!
# Background
self << (@background=GuiObject.new.set(:background_image => $engine.load_image('images/actor-flyout-background.png')))
# Edit director button
Method handle_sdl_event
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_sdl_event(event)
case event
# Mouse input
when SDL2::Event::MouseMotion
$engine.on_slider_change(MOUSE_1_X, (event.x / (@width - 1).to_f))
Method update_environment
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_environment
beat_scale = @beat_detector.progress # a fuzzy (0.0 to 1.0 inclusive) measure of progress within the current beat
bpm = @beat_detector.beats_per_minute
# Integer beat counts
Method deep_clone
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def deep_clone(cloned_objects = {}, &is_cloneable_callback)
return cloned_objects[self] if cloned_objects[self]
case self
when Hash
klone = self.clone.clear
Method load_file
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def load_file(file_path)
return false unless File.exists? file_path
start_time = Time.now.to_f
Method decode_io
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.decode_io(io, &proc)
# Packets start with OSC address
address = decode_string(io)
# Special BUNDLE address
- 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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def initialize(address, tags=nil, *args)
@address = address
@args = []
args.each_with_index do |arg, i|
if tags && tags[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 after_load
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def after_load
super
# range is the hard limit: we won't return values outside the range
@options[:range] ||= DEFAULT_RANGE
- 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 on_key_press
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def on_key_press(key)
return super if key.control?
case key
when 'space'
# ignore
- 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 value
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def value
return starting_value if first_frame?
on = $engine.button_down?(button_on)
off = $engine.button_down?(button_off)
- 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 load_file
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def load_file(file_path)
return false unless File.exists? file_path
start_time = Time.now.to_f
- 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 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render!
user_object_try {
if (offscreen_render_actor.present? && !$env[:hit_test])
with_offscreen_buffer { |buffer|
# render scene to offscreen buffer
Method build_editor_for
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_editor_for(user_object, options={})
return unless user_object
# extract options
grab_keyboard_focus = options.delete(:grab_keyboard_focus)
Method from_hsl
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def from_hsl(hue, sat, lum, ignored = nil)
return set([0.0,0.0,0.0]) if lum == 0.0 # if luminosity is zero, the colour is always black
return set([1.0,1.0,1.0]) if lum == 1.0 # if luminosity is one, the colour is always white
return set([lum, lum, lum]) if sat <= 1e-5 # if saturation is zero, the colour is always a greyscale colour
Method render
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render
# Copy Cairo surface to OpenGL texture
if @last_copy_to_texture_frame_number != $env[:frame_number]
cc = cairo_canvas