lighttroupe/luz-next

View on GitHub

Showing 160 of 250 total issues

Method change_for_distance has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def change_for_distance(distance)        # distance is in screen space-- the mouse's playground!
        @gui_previous_count ||= 0

        distance_abs = distance.abs
        count, remainder = $env[:beat].divmod(0.5)
Severity: Minor
Found in gui/gui_time_control.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 a Cognitive Complexity of 14 (exceeds 5 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

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 change_for_distance has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def change_for_distance(distance)        # distance is in screen space-- the mouse's playground!
        @gui_previous_count ||= 0

        distance_abs = distance.abs
        count, remainder = $env[:beat].divmod(0.5)
Severity: Minor
Found in gui/gui_integer.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 update_hold has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def update_hold
        @hover_object.click_hold(self) if @hover_object.respond_to?(:click_hold)        # repeated calls once per frame

        if dragging?
            update_drag
Severity: Minor
Found in gui/pointer.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 gui_build_editor has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def gui_build_editor
        if @user_object.respond_to? :effects
            box = GuiBox.new

            # Effects list
Severity: Minor
Found in gui/gui_user_object_editor.rb - About 1 hr to fix

    Method on_new_message has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def on_new_message(address, value)
            if value.is_a? Float
                slider_change_notify(address, (value > 1.0) ? 1.0 : ((value < 0.0) ? 0.0 : value))
            elsif value.is_a? Integer
                if value >= 1
    Severity: Minor
    Found in engine/message_bus.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 deep_clone has a Cognitive Complexity of 13 (exceeds 5 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

    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 trash! has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def trash!(user_object)
            case user_object
            when Actor
                if user_object == self.chosen_director.offscreen_render_actor.actor
                    self.chosen_director.offscreen_render_actor.actor = nil
    Severity: Minor
    Found in gui/gui_default.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 13 (exceeds 5 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

    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 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def render
            total_children = [number_x.abs + 1, number_y.abs + 1].max
    
            for y in (-number_y..number_y)
                for x in (-number_x..number_x)
    Severity: Minor
    Found in engine/plugins/actor_effects/grid-offset.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 to_hsl has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def to_hsl
            min   = [@red, @green, @blue].min
            max   = [@red, @green, @blue].max
            delta = (max - min).to_f
            lum   = (max + min) / 2.0
    Severity: Minor
    Found in utils/color.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 is_over has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def is_over(object)        # NOTE: object is nil if no object
            if @hover_object == object
                # do no work for the common case of "still hovering" (this gets called repeatedly with the same value)
                @drag_out_notify_potential = true
                return
    Severity: Minor
    Found in gui/pointer.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 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def render
            return yield if scale == 0.0
    
            actor.one { |a|
                parent_user_object.using {
    Severity: Minor
    Found in engine/plugins/actor_effects/actor-brush.luz.rb - About 1 hr to fix

      Method render has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def render
              return yield if scale == 0.0
      
              actor.one { |a|
                  parent_user_object.using {
      Severity: Minor
      Found in engine/plugins/actor_effects/actor-pen.luz.rb - About 1 hr to fix

        Method tick has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def tick(time)
                @time = time
                elapsed = (@time - @last_beat_time)
        
                if @time > @next_planned_beat_time
        Severity: Minor
        Found in engine/beat_detector.rb - About 1 hr to fix

          Method on_key_press has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def on_key_press(key)
                  return super if key.control?
          
                  if key.alt?
                      case key
          Severity: Minor
          Found in gui/gui_grid.rb - About 1 hr to fix

            Method each_with_positioning_vertical_within_clipping has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def each_with_positioning_vertical_within_clipping
                    final_spacing_y = distance_between_items
            
                    with_translation(0.0, 0.5) {
                        with_aspect_ratio_fix_y { |fix_y|
            Severity: Minor
            Found in gui/gui_list.rb - About 1 hr to fix

              Method cycle_update has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  def cycle_update(current_spot, desired_spot, time)
                      return desired_spot if time.instant?
              
                      current_spot ||= 0.0
              
              
              Severity: Minor
              Found in engine/cycle_logic.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 gui_render has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  def gui_render
                      with_gui_object_properties {
                          with_translation(-0.25, 0.0) {
                              with_scale(0.5, 1.0) {
                                  with_alpha(@object.enable_enter_animation ? 1.0 : 0.4) {
              Severity: Minor
              Found in gui/gui_enter_exit_button.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 init_dmx has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  def init_dmx
                      require 'dmx'
              
                      # TODO: find a better method of finding the device
                      @dmx ||= DMX.new("/dev/ttyUSB0", DMX_CHANNEL_COUNT) rescue nil
              Severity: Minor
              Found in engine/engine/engine_dmx.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