lighttroupe/luz

View on GitHub

Showing 250 of 250 total issues

Method with_watch has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

        def with_watch(file_path)
            # Load file
            if yield
                # Add a watch, and when it fires, yield again
                $notifier.watch(file_path, :close_write) {
Severity: Minor
Found in engine/engine/engine_file_monitoring.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 multi_require has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def multi_require(*list)
        [*list].each { |file|
            if require(file)
                # Grab latest file name (which now includes the .rb) from $LOADED_FEATURES (list of all require'd files)
                ext = File.extname($LOADED_FEATURES.last)
Severity: Minor
Found in utils/reloadable_require.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 render has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def render
        return yield if folds == 0.0

        fold_count = folds.floor
        folds_doubled = fold_count * 2
Severity: Minor
Found in engine/plugins/actor_effects/kscope-2.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 on_key_press has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def on_key_press(key)
        if key == 'down' && !key.control?
            @actors_list.select_next!
            @actors_list.scroll_to_selection!
        elsif key == 'up' && !key.control?
Severity: Minor
Found in gui/gui_actors_flyout.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 set_objects has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def set_objects(objects)
        @objects = objects
        @objects.each { |object|
            object.on_clicked {
                @objects.each { |o2| o2.animate(:opacity => 0.2) unless object == o2 }        # FX: all but the selected item disappears
Severity: Minor
Found in gui/gui_list_popup.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 immediate_value has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def immediate_value
        return @animation_min if @options[:simple]

        # NOTE: Don't do any value caching here, as we need to resolve in various contexts in a single frame
        @last_value = @current_value
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 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 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 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 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 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 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 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 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 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 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 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 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 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

                    Severity
                    Category
                    Status
                    Source
                    Language