lighttroupe/luz

View on GitHub

Showing 160 of 250 total issues

Avoid deeply nested control flow statements.
Open

                    if searching?
                        fill_from_search! if @search != search_was
                    else
                        end_search!
                    end
Severity: Major
Found in gui/gui_add_window.rb - About 45 mins to fix

    Method render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def render
            if method == :below
                return yield if (red_cutoff == 0.0 && green_cutoff == 0.0 && blue_cutoff == 0.0 && alpha_cutoff == 0.0)
    
                with_fragment_shader_snippet(BELOW_CODE, self) {
    Severity: Minor
    Found in engine/plugins/actor_effects/pixel-mask.luz.rb - About 45 mins 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_slider_change has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def on_slider_change(name, value, delayed=false)
            return unless name
            on_new_slider(name)
    
            # special-case one type of change:
    Severity: Minor
    Found in engine/engine/engine_sliders.rb - About 45 mins 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_scene_recursive has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def render_scene_recursive(effect_index = 0, options = {}, &proc)
            if (effect_index and effect = effects[effect_index])
                if !effect.usable?
                    render_scene_recursive(effect_index + 1, options, &proc)        # Skip this effect
                else
    Severity: Minor
    Found in engine/director.rb - About 45 mins 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 each_matching_recursive has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def each_matching_recursive(pattern)    # accepts patterns like '*.png'
            each { |filename|
                unless filename == '..' or filename == '.'
                    filepath = File.join(path, filename)
    
    
    Severity: Minor
    Found in utils/addons/dir.rb - About 45 mins 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 move_to_time has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def move_to_time(time)
            time += @time_offset
    
            if @last_time
                if time < @last_time
    Severity: Minor
    Found in utils/sample_player.rb - About 45 mins 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 add_animation has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def add_animation(object, field, target_value, duration, &proc)
    Severity: Minor
    Found in utils/value_animation.rb - About 35 mins to fix

      Method render_to_image has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def render_to_image(string, font, width_in_characters, lines=1, text_align=:left)
      Severity: Minor
      Found in utils/cairo_font.rb - About 35 mins to fix

        Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def initialize(object, method, min, max, digits)
        Severity: Minor
        Found in gui/gui_float.rb - About 35 mins to fix

          Method RoundedRectangle has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def self.RoundedRectangle(radius_x, radius_y, knob_x, knob_y, detail)
          Severity: Minor
          Found in utils/gl_shapes.rb - About 35 mins to fix

            Method progress_since has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def progress_since(time, beat=nil)
                    return 1.0 if instant?
            
                    if @time_unit == :beats
                        return 0.0 if beat.nil?
            Severity: Minor
            Found in engine/user_object_settings/user_object_setting_timespan.rb - About 35 mins 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 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def value
                    now = Time.now.to_f
                    if @on_until && now < @on_until
                        true
                    else
            Severity: Minor
            Found in engine/plugins/event_inputs/slider-active.luz.rb - About 35 mins 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 pipe has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def pipe(signal, target, original_options={})
                    (signal.respond_to?(:each) ? signal : [signal]).each { |signal|
                        options = {:method => signal}.merge(original_options)
                        if options[:args]
                            module_eval( "def #{signal}(&proc) instance_variable_get('@' + '#{target.to_s}').send('#{options[:method]}', #{options[:args]}, &proc) ; end", "__(METHOD PIPING)__", 1)
            Severity: Minor
            Found in utils/method_piping.rb - About 35 mins 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 to_zaml has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def to_zaml(z)
                    z.first_time_only(self) {
                        num = '[-+]?(0x)?\d+\.?\d*'
                        case
                          when self == ''
            Severity: Minor
            Found in utils/zaml.rb - About 35 mins 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 gui_render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def gui_render
                    with_gui_object_properties {
                        object = get_value
                        if object
                            @current_value_renderer = object.new_renderer if @current_value_renderer.nil? || @current_value_renderer.object != object
            Severity: Minor
            Found in gui/gui_list_select.rb - About 35 mins 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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def update(max_packets=nil)
                    begin
                        loop {
                            # check readability of socket to avoid generating unnecessary Errno::EAGAIN exceptions
                            return if IO.select(@socket_array, nil, nil, 0).nil?
            Severity: Minor
            Found in utils/osc_server.rb - About 35 mins 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 with_enter_exit_progress has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def with_enter_exit_progress(value)
                    with_env(:enter, (value < 0.5) ? (value / 0.5) : 1.0) {
                        with_env(:exit, (value > 0.5) ? ((value - 0.5) / 0.5) : 0.0) {
                            yield
                        }
            Severity: Minor
            Found in engine/engine/engine_methods_for_user_object.rb - About 35 mins 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 delta_min_max_avg has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def delta_min_max_avg
                    min, max, total = nil, nil, 0.0
            
                    for i in 0..size-2
                        difference = self[i + 1] - self[i]
            Severity: Minor
            Found in utils/addons/array.rb - About 35 mins 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 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def value
                    @velocity ||= 0.0
            
                    # add to velocity
                    if slider > 0.0 and slider_setting.last_value == 0.0
            Severity: Minor
            Found in engine/plugins/variable_inputs/slider-impulse.luz.rb - About 35 mins 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 reload_if_newer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def reload_if_newer(filepath)
                    file = File.new(filepath) rescue nil
                    return false unless file        # no longer exists?
            
                    mtime = file.mtime
            Severity: Minor
            Found in utils/reloadable_require.rb - About 35 mins 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