lighttroupe/luz

View on GitHub

Showing 160 of 250 total issues

Method smart_step_value has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def smart_step_value(value, direction)
        swapped = false
        swapped, value, direction = true, value.abs, ((direction == :up) ? :down : :up) if value < 0.0
        # Now we can pretend we're in the positive range going up or down

Severity: Minor
Found in gui/gui_float.rb - About 2 hrs 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 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def on_key_press(key)
        if key.control?
            if key == 'e'
                $engine.view_source(@selected_object) if @selected_object
            else
Severity: Major
Found in gui/gui_add_window.rb - About 2 hrs to fix

    Class GuiUserObjectEditor has 23 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class GuiUserObjectEditor < GuiWindow
        attr_accessor :pointer
    
        BACKGROUND_COLOR = [0,0,0,0.95]
    
    
    Severity: Minor
    Found in gui/gui_user_object_editor.rb - About 2 hrs to fix

      Class UserObject has 23 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class UserObject
          include MethodsForUserObject
      
          Setting = Struct.new('Setting', :name, :klass, :options)
      
      
      Severity: Minor
      Found in engine/user_object.rb - About 2 hrs to fix

        Method build_editor_for has a Cognitive Complexity of 18 (exceeds 5 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 2 hrs 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 18 (exceeds 5 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 2 hrs 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

        Class GuiList has 22 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class GuiList < GuiBox
            VELOCITY_PER_SCROLL = 3.0
            MAX_SCROLL_VELOCITY = 16.0
            VELOCITY_DAMPER = 0.7                    # TODO: setting
        
        
        Severity: Minor
        Found in gui/gui_list.rb - About 2 hrs to fix

          Method create! has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def create!
                  @actor_view = GuiActorView.new
                  @director_view = GuiDirectorView.new
          
                  #
          Severity: Major
          Found in gui/gui_default.rb - About 2 hrs to fix

            Method load_images has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                def load_images(relative_path)
                    @images_cache ||= {}
            
                    relative_path = relative_path.without_prefix(@project.file_path) if @project.file_path
            
            
            Severity: Minor
            Found in engine/engine/engine_images.rb - About 2 hrs 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 has a Cognitive Complexity of 17 (exceeds 5 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 2 hrs 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 17 (exceeds 5 allowed). Consider refactoring.
            Open

                def render(string, font, font_size, width_in_characters, lines, text_align)
                    #line_spacing = 1.0        # TODO ?
                    border_left = 0.0
                    border_top = 0.0
            
            
            Severity: Minor
            Found in utils/cairo_font.rb - About 2 hrs 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

            Class Project has 21 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class Project < UserObject
                include Callbacks
            
                callback :changed
            
            
            Severity: Minor
            Found in engine/project.rb - About 2 hrs to fix

              Method save_project has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  def save_project
                      if $engine.project.path
                          if $engine.project.save
                              positive_message 'Project Saved'
                              yield if block_given?
              Severity: Minor
              Found in gui/gui_default.rb - About 2 hrs 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 16 (exceeds 5 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 2 hrs 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 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def render(string, font, font_size, width_in_characters, lines, text_align)
                      #line_spacing = 1.0        # TODO ?
                      border_left = 0.0
                      border_top = 0.0
              
              
              Severity: Minor
              Found in utils/cairo_font.rb - About 1 hr to fix

                Method render has a Cognitive Complexity of 15 (exceeds 5 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

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

                    def render
                        total_children = max(number_x.abs + 1, number_y.abs + 1)
                
                        for y in (-number_y..number_y)
                            for x in (-number_x..number_x)
                Severity: Minor
                Found in engine/plugins/actor_effects/grid-tiled.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 render has a Cognitive Complexity of 15 (exceeds 5 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

                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 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def on_key_press(key)
                        if key.control?
                            case key
                            when 'n'
                                if key.control?
                Severity: Minor
                Found in gui/gui_variables_flyout.rb - About 1 hr to fix

                  Method with_compiled_shader has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def with_compiled_shader
                          return yield if $fragment_shader_snippet_stack.empty? and $vertex_shader_snippet_stack.empty?
                          $next_texture_number ||= 0
                  
                          fragment_shader_source = $fragment_shader_snippet_cache[$fragment_shader_snippet_stack]
                  Severity: Minor
                  Found in utils/drawing/drawing_shader_snippets.rb - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language