lighttroupe/luz

View on GitHub

Showing 250 of 250 total issues

File gui_default.rb has 616 lines of code (exceeds 250 allowed). Consider refactoring.
Open

multi_require 'gui_pointer_behavior', 'gui_object', 'gui_value', 'gui_string', 'gui_numeric', 'gui_label', 'gui_box', 'gui_window', 'gui_hbox', 'gui_vbox', 'gui_list', 'gui_list_select', 'gui_scrollbar', 'gui_grid', 'gui_message_bar', 'gui_beat_monitor', 'gui_time_control', 'gui_button', 'gui_float', 'gui_toggle', 'gui_curve', 'gui_curve_increasing', 'gui_theme', 'gui_integer', 'gui_select', 'gui_actor', 'gui_director', 'gui_event', 'gui_variable', 'gui_font_select', 'gui_engine_button', 'gui_engine_button_renderer', 'gui_engine_slider', 'gui_engine_slider_renderer', 'gui_radio_buttons', 'gui_object_renderer', 'gui_main_menu', 'gui_settings_window', 'gui_actor_view', 'gui_director_view', 'gui_user_object_editor', 'gui_delete_button', 'gui_enter_exit_button', 'gui_enter_exit_popup', 'gui_add_window', 'gui_interface', 'gui_director_menu', 'gui_actors_flyout', 'gui_variables_flyout', 'gui_message_bus_monitor', 'gui_file_dialog', 'gui_directory_dialog', 'gui_image_dialog', 'gui_confirmation_dialog', 'keyboard', 'gui_user_object_renderer', 'gui_user_object_class_renderer', 'gui_child_user_object_renderer', 'gui_project_effect_renderer', 'gui_actor_renderer', 'gui_actor_effect_renderer', 'gui_director_renderer', 'gui_event_renderer', 'gui_event_input_renderer', 'gui_variable_renderer', 'gui_variable_input_renderer', 'gui_curve_renderer', 'gui_curve_increasing_renderer', 'gui_theme_renderer', 'gui_style_renderer', 'gui_list_popup', 'gui_output_view_button', 'gui_actor_class_flyout', 'gui_director_edit_button', 'gui_director_view_button', 'cartesian_scaffolding', 'camera', 'gui_object_renderer_button', 'gui_file_object', 'gui_class_instance_renderer_button', 'gui_actor_class_button'
load_directory(Dir.pwd + '/gui/addons/', '**.rb')        # Addons to existing objects

class GuiDefault < GuiInterface
    ACTOR_BACKGROUND_COLOR    = [0,0,0,0]
Severity: Major
Found in gui/gui_default.rb - About 1 day to fix

    Class GuiDefault has 71 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class GuiDefault < GuiInterface
        ACTOR_BACKGROUND_COLOR    = [0,0,0,0]
        DIRECTOR_BACKGROUND_COLOR = [0,0,0,0]
        ACTOR_VIEW_COLOR = [1,0.5,0.5,1]
        DIRECTOR_VIEW_COLOR = [0.5,1,0.5,1]
    Severity: Major
    Found in gui/gui_default.rb - About 1 day to fix

      Method on_key_press has a Cognitive Complexity of 46 (exceeds 5 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: Minor
      Found in gui/gui_add_window.rb - About 7 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 gui_build_editor has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
      Open

          def gui_build_editor
              box = GuiBox.new
              box << create_user_object_setting_name_label
              box << @vbox = GuiVBox.new.set(:scale_y => 0.8, :offset_y => -0.1)
      
      
      Severity: Minor
      Found in gui/addons/user_object_setting_float.rb - About 5 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 34 (exceeds 5 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 5 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 32 (exceeds 5 allowed). Consider refactoring.
      Open

          def on_key_press(key)
              if key.control?
                  case key
                  when 'f8'
                      launch_project_directory_browser
      Severity: Minor
      Found in gui/gui_default.rb - About 4 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 GuiBox has 33 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class GuiBox < GuiObject
          callback :contents_change
      
          def initialize(contents = [])
              self.contents = contents
      Severity: Minor
      Found in gui/gui_box.rb - About 4 hrs to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            def render
                return yield if scale == 0.0
        
                actor.one { |a|
                    parent_user_object.using {
        Severity: Major
        Found in engine/plugins/actor_effects/actor-brush.luz.rb and 1 other location - About 3 hrs to fix
        engine/plugins/actor_effects/actor-pen.luz.rb on lines 21..69

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 134.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            def render
                return yield if scale == 0.0
        
                actor.one { |a|
                    parent_user_object.using {
        Severity: Major
        Found in engine/plugins/actor_effects/actor-pen.luz.rb and 1 other location - About 3 hrs to fix
        engine/plugins/actor_effects/actor-brush.luz.rb on lines 17..65

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 134.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Class Pointer has 31 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class Pointer
            easy_accessor :number, :background_image, :color, :size
        
            include Drawing
        
        
        Severity: Minor
        Found in gui/pointer.rb - About 3 hrs to fix

          Method each_with_positioning_vertical_within_clipping has a Cognitive Complexity of 26 (exceeds 5 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 3 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 with_compiled_shader has a Cognitive Complexity of 26 (exceeds 5 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 3 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 GuiObject has 30 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class GuiObject
              include MethodsForUserObject
          
              include GuiPointerBehavior
              include ValueAnimation
          Severity: Minor
          Found in gui/gui_object.rb - About 3 hrs to fix

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

                def on_key_press(key)
                    if key.control?
                        case key
                        when 'f8'
                            launch_project_directory_browser
            Severity: Major
            Found in gui/gui_default.rb - About 3 hrs to fix

              Method gui_build_editor has 80 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def gui_build_editor
                      box = GuiBox.new
                      box << create_user_object_setting_name_label
                      box << @vbox = GuiVBox.new.set(:scale_y => 0.8, :offset_y => -0.1)
              
              
              Severity: Major
              Found in gui/addons/user_object_setting_float.rb - About 3 hrs to fix

                Method tick_animations! has a Cognitive Complexity of 22 (exceeds 5 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 3 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 22 (exceeds 5 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 3 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 append_from_file has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                    def append_from_file(file)
                        loaded_objects = Syck.load(file)
                
                        raise "version number '#{loaded_objects[:version]}' should be '#{FILE_VERSION}'" unless loaded_objects[:version] == FILE_VERSION
                
                
                Severity: Minor
                Found in engine/project.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 gui_render_styles has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                    def gui_render_styles
                        @object.gui_render_styles_list = GL.RenderCached(@object.gui_render_styles_list) {
                            if @object.effects.size > 8
                                num_rows = 4
                            else
                Severity: Minor
                Found in gui/gui_theme_renderer.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 Vector3 has 24 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class Vector3
                    attr_accessor :x, :y, :z
                
                    def self.new_from_string(str)
                        x, y, z = str.split(',').collect { |v| v.to_f }
                Severity: Minor
                Found in utils/vector3.rb - About 2 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language