lighttroupe/luz

View on GitHub

Showing 250 of 250 total issues

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

    def render
        # Top
        with_clip_plane([0.0,  1.0, 0.0, 0.0]) {
            yield :child_index => 0, :total_children => 2
        }
Severity: Minor
Found in engine/plugins/actor_effects/mirror-vertical.luz.rb and 1 other location - About 30 mins to fix
engine/plugins/actor_effects/mirror-horizontal.luz.rb on lines 9..19

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

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

    def render
        output_variable = output_setting.variable
        return yield unless output_variable

        first_index = $engine.project.variables.index(first_input_setting.variable)
Severity: Minor
Found in engine/plugins/actor_effects/variable-child-router.luz.rb - About 25 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 background_color has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def background_color
        if @object.now?
            if pointer_hovering? || selected?
                BACKGROUND_COLOR_ON_HOVERING
            else
Severity: Minor
Found in gui/gui_event_renderer.rb - About 25 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 hide_something! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def hide_something!
        if @directors_menu.visible?
            close_directors_menu!
            default_focus!
            true
Severity: Minor
Found in gui/gui_default.rb - About 25 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 save_pixels_to_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def save_pixels_to_path(pixels, output_filepath)
        # Check for presence of raw->png converter app NOTE: only does this once
        @raw_image_encoder_present = !(open("|which #{RAW_IMAGE_ENCODER_NAME}").read.empty?) if @raw_image_encoder_present.nil?

        if @raw_image_encoder_present
Severity: Minor
Found in engine/plugins/project_effects/screen-capture.luz.rb - About 25 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_vertex_shader_snippet has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def with_vertex_shader_snippet(snippet, object)
        return yield unless snippet         # allow nil

        index = $vertex_shader_object_stack.count

Severity: Minor
Found in utils/drawing/drawing_shader_snippets.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

    def value
        if $engine.button_down?(button)
            return 1.0 if on_time.instant?
            last_value + ($env[:frame_time_delta] / on_time.to_seconds)
        else
Severity: Minor
Found in engine/plugins/variable_inputs/button.luz.rb - About 25 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 background_color has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def background_color
        if @object.now?
            if pointer_hovering? || selected?
                BACKGROUND_COLOR_ON_HOVERING
            else
Severity: Minor
Found in gui/gui_event_input_renderer.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

    def value
        if $engine.button_pressed_this_frame?(record)
            #
            # Begin Recording
            #
Severity: Minor
Found in engine/plugins/variable_inputs/slider-repeater-measure.luz.rb - About 25 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 load_from_rmagick_image has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def load_from_rmagick_image(image)
        $support_non_power_of_two = Gl.is_available?("ARB_texture_non_power_of_two") if $support_non_power_of_two.nil?

        unless $support_non_power_of_two
            # Ensure powers of two textures
Severity: Minor
Found in utils/image.rb - About 25 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 background_color has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def background_color
        if selected?
            if pointer_hovering?
                BACKGROUND_COLOR_SELECTED_AND_HOVERING
            else
Severity: Minor
Found in gui/gui_object.rb - About 25 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 create! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def create!
        # Background
        self << (@background=GuiObject.new.set(:background_image => $engine.load_image('images/enter-exit-popup.png')))

        self << (@enter_value_widget=GuiFloat.new(@object, :enter_value, @object.min, @object.max, digits=2).set(:scale_x => 0.20, :scale_y => 0.8, :float => :left))
Severity: Minor
Found in gui/gui_enter_exit_popup.rb - About 25 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 tick has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def tick
        #
        # Auto-start if this is the first tick
        #
        if (@last_update_frame.nil?) or (@last_update_frame < ($env[:frame_number] - 1))
Severity: Minor
Found in engine/plugins/director_effects/cue-sheet.luz.rb - About 25 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_needed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def reload_if_needed
        if file_name != @file_name
            if $engine.project.file_path
                path = File.join($engine.project.file_path, file_name)
                @file = FFmpeg::File.new(path) if File.file?(path)
Severity: Minor
Found in engine/plugins/actor_effects/video.luz.rb - About 25 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_recursively has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def render_recursively(user_objects, index=0, &proc)
        uo = user_objects[index]
        return proc.call unless uo

        if uo.usable?
Severity: Minor
Found in engine/engine/engine_rendering.rb - About 25 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_fragment_shader_snippet has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def with_fragment_shader_snippet(snippet, object)
        return yield unless snippet        # allow nil

        index = $fragment_shader_object_stack.count

Severity: Minor
Found in utils/drawing/drawing_shader_snippets.rb - About 25 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 tick has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def tick
        $engine.with_dmx(channel) { |dmx|
            # This is needed to turn on the light
            dmx.set(1, 245)

Severity: Minor
Found in engine/plugins/director_effects/dmx-martin-mx10-extreme.luz.rb - About 25 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 choose_column_count has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def choose_column_count
        if @grid.count > 49
            8
        elsif @grid.count > 36
            7
Severity: Minor
Found in gui/gui_director_menu.rb - About 25 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 choose_project_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def choose_project_path
        @dialog_container << dialog = GuiDirectoryDialog.new('Choose Directory for New project.luz')        # TODO: convert to a save-file-to-directory situation
        dialog.on_closed { dialog.remove_from_parent! }
        dialog.on_selected { |path|
            dialog.remove_from_parent!
Severity: Minor
Found in gui/gui_default.rb - About 25 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

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

class UserObjectSettingTheme < UserObjectSetting
    attr_accessor :theme

    def to_yaml_properties
        super + ['@theme']
Severity: Minor
Found in engine/user_object_settings/user_object_setting_theme.rb and 1 other location - About 25 mins to fix
engine/user_object_settings/user_object_setting_curve.rb on lines 3..20

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

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

Severity
Category
Status
Source
Language