deployphp/deployer

View on GitHub
src/Executor/Master.php

Summary

Maintainability
D
2 days
Test Coverage

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

    public function run(array $tasks, array $hosts, ?Planner $plan = null): int
    {
        $globalLimit = (int) $this->input->getOption('limit') ?: count($hosts);

        foreach ($tasks as $task) {
Severity: Minor
Found in src/Executor/Master.php - About 1 day 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 71 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function run(array $tasks, array $hosts, ?Planner $plan = null): int
    {
        $globalLimit = (int) $this->input->getOption('limit') ?: count($hosts);

        foreach ($tasks as $task) {
Severity: Major
Found in src/Executor/Master.php - About 2 hrs to fix

    Method runTask has 67 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function runTask(Task $task, array $hosts): int
        {
            if (getenv('DEPLOYER_LOCAL_WORKER') === 'true') {
                // This allows to code coverage all recipe,
                // as well as speedup tests by not spawning
    Severity: Major
    Found in src/Executor/Master.php - About 2 hrs to fix

      Function runTask has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          private function runTask(Task $task, array $hosts): int
          {
              if (getenv('DEPLOYER_LOCAL_WORKER') === 'true') {
                  // This allows to code coverage all recipe,
                  // as well as speedup tests by not spawning
      Severity: Minor
      Found in src/Executor/Master.php - 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

      Avoid too many return statements within this method.
      Open

              return $this->cumulativeExitCode($processes);
      Severity: Major
      Found in src/Executor/Master.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                            return new Response(404, null);
        Severity: Major
        Found in src/Executor/Master.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                              return new Response(200, $answer);
          Severity: Major
          Found in src/Executor/Master.php - About 30 mins to fix

            There are no issues that match your filters.

            Category
            Status