lighttroupe/luz

View on GitHub

Showing 250 of 250 total issues

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

Method render has 27 lines of code (exceeds 25 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

    Method build_editor_for has 27 lines of code (exceeds 25 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 1 hr to fix

      Method from_hsl has 27 lines of code (exceeds 25 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

        Method render! has 27 lines of code (exceeds 25 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 1 hr to fix

          Method append_from_file has 26 lines of code (exceeds 25 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 1 hr to fix

            Method gui_render_styles has 26 lines of code (exceeds 25 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 1 hr to fix

              Method decode_io has 26 lines of code (exceeds 25 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

                Method on_key_press has 26 lines of code (exceeds 25 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

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

                      def create!
                          self << @cancel_button = GuiButton.new.set(:scale_x => 0.05, :scale_y => 0.06, :offset_x => -0.475, :offset_y => 0.47, :background_image => $engine.load_image('images/buttons/main-menu-close.png'), :background_image_hover => $engine.load_image('images/buttons/main-menu-close-hover.png'), :background_image_click => $engine.load_image('images/buttons/main-menu-close-click.png'))
                          @cancel_button.on_clicked { close_notify }
                  
                          self << @open_button = GuiButton.new.set(:scale_x => 0.05, :scale_y => 0.06, :offset_x => 0.475, :offset_y => 0.47, :background_image => $engine.load_image('images/buttons/main-menu-open.png'), :background_image_hover => $engine.load_image('images/buttons/main-menu-open-hover.png'), :background_image_click => $engine.load_image('images/buttons/main-menu-open-click.png'))
                  Severity: Minor
                  Found in gui/gui_main_menu.rb - About 1 hr to fix

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

                            snippets_with_variables = snippets.collect_with_index { |snippet, index|
                                object = objects[index]
                                object.settings.each { |setting|
                                    if setting.shader?
                                        # TODO: improve find-and-replace
                    Severity: Minor
                    Found in utils/drawing/drawing_shader_snippets.rb and 1 other location - About 55 mins to fix
                    utils/drawing/drawing_shader_snippets.rb on lines 215..228

                    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 46.

                    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

                            snippets_with_variables = snippets.collect_with_index { |snippet, index|
                                object = objects[index]
                                object.settings.each { |setting|
                                    if setting.shader?
                                        # TODO: improve find-and-replace
                    Severity: Minor
                    Found in utils/drawing/drawing_shader_snippets.rb and 1 other location - About 55 mins to fix
                    utils/drawing/drawing_shader_snippets.rb on lines 275..288

                    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 46.

                    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

                    Method tick has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def tick
                            @from_director ||= starting_director.one
                            @to_directors_queue ||= []
                    
                            if forwards.now?
                    Severity: Minor
                    Found in engine/plugins/project_effects/director-to-selected.luz.rb - About 55 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_key_press has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def on_key_press(key)
                            if key.control?
                                case key
                                when 'n'
                                    add_new_director!
                    Severity: Minor
                    Found in gui/gui_director_menu.rb - About 55 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_tick has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def gui_tick
                            super
                            if allow_scrolling?
                                starting_scroll = @scroll
                    
                    
                    Severity: Minor
                    Found in gui/gui_list.rb - About 55 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_texture_of_previous_frame has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def with_texture_of_previous_frame(number_back)
                            if $previous_frames and $previous_frames.size >= number_back
                                index = $previous_frames_current_frame_index - number_back
                                index += $previous_frames.size if index < 0
                                #puts "chosen index=#{index} which has fbo_id=#{$previous_frames[index]}"
                    Severity: Minor
                    Found in utils/drawing/drawing_frame_saving.rb - About 55 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 fill_from_category! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def fill_from_category!
                            clear_list!
                    
                            find_valid_effect_classes.each { |object|
                                next unless (@category.nil? || object.in_category?(@category))
                    Severity: Minor
                    Found in gui/gui_add_window.rb - About 55 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 immediate_value has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def immediate_value
                            @last_value = @current_value
                    
                            # Get raw value, as reported by physical input (MIDI slider, mouse x/y, joystick axis, etc.)
                            v = $engine.slider_value(@slider)
                    Severity: Minor
                    Found in engine/user_object_settings/user_object_setting_slider.rb - About 55 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 from_bgra8_partial has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def from_bgra8_partial(data, data_width, data_height, x, y, width, height)
                    Severity: Major
                    Found in utils/image.rb - About 50 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language