deployphp/deployer

View on GitHub

Showing 143 of 189 total issues

Function parse has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    public function parse(string $source): void
    {
        $comment = '';
        $params = '';

Severity: Minor
Found in src/Documentation/ApiGen.php - 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 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

    Function collect has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function collect(InputInterface $input, OutputInterface $output): array
        {
            $arguments = [];
            foreach ($input->getOptions() as $name => $value) {
                if (!$input->getOption($name)) {
    Severity: Minor
    Found in src/Ssh/IOArguments.php - 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 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 createTreeFromTaskName has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          private function createTreeFromTaskName(string $taskName, string $postfix = '', bool $isLast = false)
          {
              $task = $this->deployer->tasks->get($taskName);
      
              if (!$task->isEnabled()) {
      Severity: Minor
      Found in src/Command/TreeCommand.php - 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

      Function getTasks has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getTasks(string $name, ?string $startFrom = null, array &$skipped = []): array
          {
              $tasks = [];
              $this->visitedTasks = [];
              $allTasks = $this->doGetTasks($name);
      Severity: Minor
      Found in src/Task/ScriptManager.php - 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

      Function handValue has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function handValue(array $hand): int
          {
              $aces = 0;
              $value = 0;
              foreach ($hand as [$rank]) {
      Severity: Minor
      Found in src/Command/BlackjackCommand.php - 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

      Function colorize_host has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      function colorize_host(string $alias): string
      {
          if (defined('NO_ANSI')) {
              return $alias;
          }
      Severity: Minor
      Found in src/Support/helpers.php - 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

      Function doGetTasks has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          public function doGetTasks(string $name): array
          {
              if (array_key_exists($name, $this->visitedTasks)) {
                  if ($this->visitedTasks[$name] >= 100) {
                      throw new Exception("Looks like a circular dependency with \"$name\" task.");
      Severity: Minor
      Found in src/Task/ScriptManager.php - 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 run has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function run(Host $host, string $command, array $config = []): string
          {
              $defaults = [
                  'timeout' => $host->get('default_timeout', 300),
                  'idle_timeout' => null,
      Severity: Major
      Found in src/Ssh/SshClient.php - About 2 hrs to fix

        File Deployer.php has 258 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        declare(strict_types=1);
        
        /* (c) Anton Medvedev <anton@medv.io>
        Severity: Minor
        Found in src/Deployer.php - About 2 hrs to fix

          Method handValue has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function handValue(array $hand): int
              {
                  $aces = 0;
                  $value = 0;
                  foreach ($hand as [$rank]) {
          Severity: Major
          Found in src/Command/BlackjackCommand.php - About 2 hrs to fix

            Method execute has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function execute(Input $input, Output $output): int
                {
                    $this->deployer->input = $input;
                    $this->deployer->output = $output;
                    $this->deployer['log'] = $input->getOption('log');
            Severity: Major
            Found in src/Command/MainCommand.php - About 2 hrs to fix

              Function execute has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function execute(InputInterface $input, OutputInterface $output): int
                  {
                      $this->telemetry();
                      $hostname = $input->getArgument('hostname');
                      if (!empty($hostname)) {
              Severity: Minor
              Found in src/Command/SshCommand.php - 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

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

                  public static function run(string $version, ?string $deployFile): void
                  {
                      if (str_contains($version, 'master')) {
                          // Get version from composer.lock
                          $lockFile = __DIR__ . '/../../../../composer.lock';
              Severity: Minor
              Found in src/Deployer.php - 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 renderException has 52 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function renderException(Throwable $exception, Host $host): void
                  {
                      if ($exception instanceof RunException) {
              
                          $message = "";
              Severity: Major
              Found in src/Executor/Messenger.php - About 2 hrs to fix

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

                function run(string $command, ?array $options = [], ?int $timeout = null, ?int $idle_timeout = null, ?string $secret = null, ?array $env = null, ?bool $real_time_output = false, ?bool $no_throw = false): string
                {
                    $namedArguments = [];
                    foreach (['timeout', 'idle_timeout', 'secret', 'env', 'real_time_output', 'no_throw'] as $arg) {
                        if ($$arg !== null) {
                Severity: Major
                Found in src/functions.php - About 2 hrs to fix

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

                  function run(string $command, ?array $options = [], ?int $timeout = null, ?int $idle_timeout = null, ?string $secret = null, ?array $env = null, ?bool $real_time_output = false, ?bool $no_throw = false): string
                  {
                      $namedArguments = [];
                      foreach (['timeout', 'idle_timeout', 'secret', 'env', 'real_time_output', 'no_throw'] as $arg) {
                          if ($$arg !== null) {
                  Severity: Minor
                  Found in src/functions.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

                  Function array_merge_alternate has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function array_merge_alternate(array $original, array $override): array
                  {
                      foreach ($override as $key => $value) {
                          if (isset($original[$key])) {
                              if (!is_array($original[$key])) {
                  Severity: Minor
                  Found in src/Support/helpers.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

                  Function apply has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function apply(?array $conditions, Host $host): bool
                      {
                          if (empty($conditions)) {
                              return true;
                          }
                  Severity: Minor
                  Found in src/Selector/Selector.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

                  Severity
                  Category
                  Status
                  Source
                  Language