lighttroupe/luz-next

View on GitHub

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
Severity: Minor
Found in utils/drawing/drawing_shader_snippets.rb - About 1 hr to fix

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
Severity: Minor
Found in utils/value_animation.rb - About 1 hr to fix

    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'
    Severity: Minor
    Found in gui/gui_user_object_editor.rb - About 1 hr to fix

      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|
      Severity: Minor
      Found in engine/plugins/actor_effects/text-children.luz.rb - About 1 hr to fix

        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
        Severity: Minor
        Found in gui/gui_actors_flyout.rb - About 1 hr to fix

          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
          Severity: Minor
          Found in engine/plugins/director_effects/dmx-actor-effects.luz.rb - About 1 hr to fix

            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))
            Severity: Minor
            Found in luz_performer.rb - About 1 hr to fix

              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
              Severity: Minor
              Found in utils/deep_clone.rb - About 1 hr to fix

                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
                Severity: Minor
                Found in engine/engine/engine_environment.rb - About 1 hr to fix

                  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
                  
                  
                  Severity: Minor
                  Found in utils/midi_file_reader.rb - About 1 hr to fix

                    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
                    
                    
                    Severity: Minor
                    Found in utils/midi_file_reader.rb - About 1 hr to fix

                    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
                    Severity: Minor
                    Found in gui/gui_numeric.rb - About 1 hr to fix

                    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)
                    Severity: Minor
                    Found in engine/plugins/variable_inputs/button-pair.luz.rb - About 1 hr to fix

                    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
                    Severity: Minor
                    Found in engine/user_object_settings/user_object_setting_float.rb - About 1 hr to fix

                    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 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
                    Severity: Minor
                    Found in utils/osc.rb - About 1 hr to fix

                    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]
                    Severity: Minor
                    Found in utils/osc.rb - About 1 hr to fix

                    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 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
                    
                    
                    Severity: Minor
                    Found in utils/color.rb - About 1 hr to fix

                      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
                      Severity: Minor
                      Found in engine/actor_canvas.rb - About 1 hr to fix

                        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)
                        Severity: Minor
                        Found in gui/gui_default.rb - About 1 hr to fix

                          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
                          Severity: Minor
                          Found in engine/director.rb - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language