piotrmurach/finite_machine

View on GitHub

Showing 8 of 8 total issues

Class Observer has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Observer < GenericDSL
    include Safety

    # The current state machine
    attr_reader :machine
Severity: Minor
Found in lib/finite_machine/observer.rb - About 2 hrs to fix

    Class StateMachine has 24 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class StateMachine
        include Threadable
        include Catchable
        extend Forwardable
    
    
    Severity: Minor
    Found in lib/finite_machine/state_machine.rb - About 2 hrs to fix

      Method process_events has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def process_events
            until @dead
              @mutex.synchronize do
                while @queue.empty?
                  @not_empty.wait(@mutex)
      Severity: Minor
      Found in lib/finite_machine/message_queue.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 call has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def call(transitions)
            StateParser.parse(transitions) do |from, to|
              transition = Transition.new(@machine.env.target, @name,
                                          @attributes.merge(states: { from => to }))
              silent = @attributes.fetch(:silent, false)
      Severity: Minor
      Found in lib/finite_machine/transition_builder.rb - About 35 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 call has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def call(target, *args, &block)
            case object
            when Symbol
              target.public_send(object.to_sym, *args, &block)
            when String
      Severity: Minor
      Found in lib/finite_machine/callable.rb - About 35 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 trigger! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def trigger!(event_name, *data, &block)
            from = current # Save away current state
      
            sync_exclusive do
              notify HookEvent::Before, event_name, from, *data
      Severity: Minor
      Found in lib/finite_machine/state_machine.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize(*args, &block)
            options = args.last.is_a?(::Hash) ? args.pop : {}
            @initial_state = DEFAULT_STATE
            @auto_methods  = options.fetch(:auto_methods, true)
            @subscribers   = Subscribers.new
      Severity: Minor
      Found in lib/finite_machine/state_machine.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 on has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def on(hook_type, state_or_event_name = nil, async = nil, &callback)
            sync_exclusive do
              if state_or_event_name.nil?
                state_or_event_name = HookEvent.any_state_or_event(hook_type)
              end
      Severity: Minor
      Found in lib/finite_machine/observer.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

      Severity
      Category
      Status
      Source
      Language