pluf/workflow

View on GitHub

Showing 56 of 58 total issues

Function internalFire has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    private function internalFire($event, $context, bool $insertAtFirst = false): void
    {
        if ($this->getStatus() == 'INITIALIZED') {
            if ($this->autoStartEnabled) {
                $this->start($context);
Severity: Minor
Found in src/Imp/StateMachineImpl.php - About 45 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 __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        public $xception,
        public $from,
        public $currentState,
        public $event,
        public $context,
Severity: Minor
Found in src/Imp/Events/TransitionExceptionEventImpl.php - About 45 mins to fix

    Method defer has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function defer($action, $from, $to, $event, $context, $stateMachine): void
    Severity: Minor
    Found in src/Imp/ExecutionServiceImpl.php - About 45 mins to fix

      Method isMatch has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function isMatch($fromState, $toState, $event, int $priority, ?string $condClazz = null, ?string $type = null): bool
      Severity: Minor
      Found in src/Imp/TransitionImpl.php - About 45 mins to fix

        Method isMatch has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            function isMatch($fromState, $toState, $event, int $priority, ?string $condClazz = null, ?string $type = null): bool;
        Severity: Minor
        Found in src/ImmutableTransition.php - About 45 mins to fix

          Method defer has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              function defer(Action $action, $from, $to, $event, $context, $stateMachine): void;
          Severity: Minor
          Found in src/ActionExecutionService.php - About 45 mins to fix

            Method processEvent has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                private function processEvent($event, $context, StateMachineData $originalData, ExecutionServiceImpl $executionService, bool $DataIsolateEnabled): bool
            Severity: Minor
            Found in src/Imp/StateMachineImpl.php - About 35 mins to fix

              Method __invoke has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function __invoke($from, $to, $event, $context, $stateMachine)
              Severity: Minor
              Found in src/Actions/FinalStateGuardAction.php - About 35 mins to fix

                Method defineTimedState has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function defineTimedState($stateId, int $initialDelay, int $timeInterval, $autoEvent, $autoContext): MutableState
                Severity: Minor
                Found in src/Imp/StateMachineBuilderImpl.php - About 35 mins to fix

                  Method defineTimedState has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      function defineTimedState($stateId, int $initialDelay, int $timeInterval, $autoEvent, $autoContext): MutableState;
                  Severity: Minor
                  Found in src/StateMachineBuilder.php - About 35 mins to fix

                    Function processEvent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function processEvent($event, $context, StateMachineData $originalData, ExecutionServiceImpl $executionService, bool $DataIsolateEnabled): bool
                        {
                            $localData = $originalData;
                            $fromState = $localData->read()->getCurrentRawState();
                            $fromStateId = $fromState->getStateId();
                    Severity: Minor
                    Found in src/Imp/StateMachineImpl.php - 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

                    Function buildDeclareState has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function buildDeclareState(State $state): void
                        {
                            // Preconditions.checkState(stateConverter!=null, "Do not register state converter");
                            $stateId = $state->name;
                            // Preconditions.checkNotNull(stateId, "Cannot convert state of name \""+state.name()+"\".");
                    Severity: Minor
                    Found in src/Imp/StateMachineBuilderImpl.php - 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

                    Avoid too many return statements within this method.
                    Open

                            return true;
                    Severity: Major
                    Found in src/Imp/TransitionImpl.php - About 30 mins to fix

                      Function internalFire has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function internalFire(StateContext $stateContext): void
                          {
                              // Fix issue17
                              if ($this->type == TransitionType::INTERNAL && $stateContext->getSourceState()->getStateId() != $this->targetState->getStateId()) {
                                  return;
                      Severity: Minor
                      Found in src/Imp/TransitionImpl.php - 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

                      Function enterByHistory has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function enterByHistory($stateContext): ImmutableState
                          {
                              if ($this->finalState || $this->isParallelState()) // no historical info
                                  return this;
                      
                      
                      Severity: Minor
                      Found in src/Imp/StateImpl.php - 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

                      Function run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function run(ActionContext $context, Container $containerOrigin): Container
                          {
                              // init container to isolate for each action
                              $container = new Container($containerOrigin);
                              $container['from'] = Container::value($context->from);
                      Severity: Minor
                      Found in src/Imp/ExecutionServiceImpl.php - 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