lighttroupe/luz

View on GitHub

Showing 250 of 250 total issues

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

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

    def gui_render
        with_color(on? ? $gui.view_color : BEAT_OFF_COLOR) {
            with_scale(on? ? ($env[:beat_scale].scale(1.0, 0.9)) : 1.0) {
                with_multiplied_alpha(on? ? ($env[:beat_scale].scale(1.0, 0.0)) : 0.0) {
                    background_image.using {
Severity: Minor
Found in gui/gui_beat_monitor.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 value has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def value
        return spring_value if first_frame?

        on = $engine.button_down?(button_on)
        off = $engine.button_down?(button_off)
Severity: Minor
Found in engine/plugins/variable_inputs/button-pair-spring.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 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 run has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def run
        start_time_ms = SDL2.get_ticks
        frame_number = 1

        until finished?
Severity: Minor
Found in utils/sdl_application.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 set_texture_options has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def set_texture_options(options)
        using {
            # TODO: make these based on instance variables and part of Drawing
            GL.TexParameter(GL::TEXTURE_2D, GL::TEXTURE_WRAP_S, options[:repeat] ? GL::REPEAT : GL::CLAMP) #REPEAT)            # REPEAT mode adds noise to the transparent edge of a texture opposite an opaque edge
            GL.TexParameter(GL::TEXTURE_2D, GL::TEXTURE_WRAP_T, options[:repeat] ? GL::REPEAT : GL::CLAMP) #REPEAT)
Severity: Minor
Found in utils/image.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 join_fragment_shader_snippet_stack has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def join_fragment_shader_snippet_stack(uniforms, snippets, objects)
        return FRAGMENT_SHADER_STUB if snippets.empty?

        #
        # Source code for uniforms declarations at top of shader scripts
Severity: Minor
Found in utils/drawing/drawing_shader_snippets.rb - About 1 hr to fix

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

        def render
            if $env[:hit_test]
                # render nothing when hit testing
                yield
    
    
    Severity: Minor
    Found in engine/plugins/director_effects/camera.luz.rb - About 1 hr to fix

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

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

            def render
                return yield if amount == 1.0
        
                if amount < 1.0
                    code = "
        Severity: Minor
        Found in engine/plugins/actor_effects/contrast.luz.rb - About 1 hr to fix

          Method join_vertex_shader_snippet_stack has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def join_vertex_shader_snippet_stack(uniforms, snippets, objects)
                  return VERTEX_SHADER_STUB if snippets.empty?
          
                  #
                  # Source code for uniforms declarations at top of shader scripts
          Severity: Minor
          Found in utils/drawing/drawing_shader_snippets.rb - About 1 hr to fix

            Method run has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def run
                    start_time_ms = SDL2.get_ticks
                    frame_number = 1
            
                    until finished?
            Severity: Minor
            Found in utils/sdl_application.rb - About 1 hr to fix

              Method command_line_options has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def command_line_options
                      OptionParser.new do |opts|
                          opts.banner = "Usage: luz.rb [options] [project.luz]"
              
                          opts.on("--width <width>", Integer, "Resolution width (eg. 800)") do |w|
              Severity: Minor
              Found in luz_performer.rb - About 1 hr to fix

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

                    def with_fragment_shader_snippet(snippet, object)
                        return yield unless snippet        # allow nil
                
                        index = $fragment_shader_object_stack.count
                
                
                Severity: Major
                Found in utils/drawing/drawing_shader_snippets.rb and 1 other location - About 1 hr to fix
                utils/drawing/drawing_shader_snippets.rb on lines 81..105

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

                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 with_vertex_shader_snippet(snippet, object)
                        return yield unless snippet         # allow nil
                
                        index = $vertex_shader_object_stack.count
                
                
                Severity: Major
                Found in utils/drawing/drawing_shader_snippets.rb and 1 other location - About 1 hr to fix
                utils/drawing/drawing_shader_snippets.rb on lines 54..78

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

                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

                Identical blocks of code found in 2 locations. 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: Major
                Found in gui/gui_time_control.rb and 1 other location - About 1 hr to fix
                gui/gui_integer.rb on lines 26..43

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

                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

                Identical blocks of code found in 2 locations. 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: Major
                Found in gui/gui_integer.rb and 1 other location - About 1 hr to fix
                gui/gui_time_control.rb on lines 23..40

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

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

                    def with_pixel_combine_function(name)
                        return yield unless name
                
                        case name
                        #
                Severity: Minor
                Found in utils/drawing/drawing_color.rb - About 1 hr to fix

                  Method gui_render_child_conditions has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def gui_render_child_conditions
                          if @object.conditions.enable_child_index
                              #@conditions_index_range_label = nil
                              @conditions_index_range_label ||= GuiLabel.new.set(:text_align => :right, :width => 8, :scale_x => 0.45, :scale_y => 0.45, :color => LABEL_CHILD_INDEX_RANGE_COLOR)
                              with_translation(0.25, 0.25) {
                  Severity: Minor
                  Found in gui/gui_child_user_object_renderer.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