AndyObtiva/glimmer-dsl-swt

View on GitHub
lib/glimmer/swt/custom/animation.rb

Summary

Maintainability
C
1 day
Test Coverage

Class Animation has 30 methods (exceeds 20 allowed). Consider refactoring.
Open

      class Animation
        include Properties
        include Glimmer::DataBinding::ObservableModel
        
        class << self
Severity: Minor
Found in lib/glimmer/swt/custom/animation.rb - About 3 hrs to fix

    Method draw_frame has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

            def draw_frame(start_number)
              if stopped? or
                  (start_number != @start_number) or
                  (frame_count_limited? && @frame_index == @frame_count) or
                  (cycle_limited? && @cycle_count_index == @cycle_count) or
    Severity: Minor
    Found in lib/glimmer/swt/custom/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 start has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

            def start
              return if @start_number > 0 && started?
              @start_number += 1
              @start_time = Time.now
              @duration = 0
    Severity: Minor
    Found in lib/glimmer/swt/custom/animation.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 draw_frame has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def draw_frame(start_number)
              if stopped? or
                  (start_number != @start_number) or
                  (frame_count_limited? && @frame_index == @frame_count) or
                  (cycle_limited? && @cycle_count_index == @cycle_count) or
    Severity: Minor
    Found in lib/glimmer/swt/custom/animation.rb - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

                if stopped? or
                    (start_number != @start_number) or
                    (frame_count_limited? && @frame_index == @frame_count) or
                    (cycle_limited? && @cycle_count_index == @cycle_count) or
                    surpassed_duration_limit?
      Severity: Major
      Found in lib/glimmer/swt/custom/animation.rb - About 1 hr to fix

        Method next_animation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                  def next_animation
                    animation = nil
                    while frame_animation_queues.values.reduce(:+)&.any? && (animation.nil? || frame_animation_queue(animation).last.nil?)
                      animation = frame_animation_queues.keys[next_animation_index]
                      frame_animation_queues.delete(animation) if frame_animation_queues.values.reduce(:+)&.any? && !animation.nil? && frame_animation_queue(animation).empty?
        Severity: Minor
        Found in lib/glimmer/swt/custom/animation.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

        There are no issues that match your filters.

        Category
        Status