deployphp/deployer

View on GitHub

Showing 143 of 189 total issues

Function import has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function import($paths)
    {
        if (!is_array($paths)) {
            $paths = [$paths];
        }
Severity: Minor
Found in src/Importer/Importer.php - About 55 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 hosts has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected static function hosts(array $hosts)
    {
        foreach ($hosts as $alias => $config) {
            if ($config['local'] ?? false) {
                $host = localhost($alias);
Severity: Minor
Found in src/Importer/Importer.php - About 55 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 before has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected static function before(array $before)
    {
        foreach ($before as $key => $value) {
            if (is_array($value)) {
                foreach (array_reverse($value) as $v) {
Severity: Minor
Found in src/Importer/Importer.php - About 55 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 after has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected static function after(array $after)
    {
        foreach ($after as $key => $value) {
            if (is_array($value)) {
                foreach (array_reverse($value) as $v) {
Severity: Minor
Found in src/Importer/Importer.php - About 55 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 runLocally has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

function runLocally(string $command, ?array $options = [], ?int $timeout = null, ?int $idle_timeout = null, ?string $secret = null, ?array $env = null, ?string $shell = null): string
Severity: Major
Found in src/functions.php - About 50 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                while (!preg_match('/^}\);$/', $line)) {
                                    $body[] = trim($line);
                                    $line = $lines[++$i];
                                }
    Severity: Major
    Found in src/Documentation/DocRecipe.php - About 45 mins to fix

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

          public function run(): void
          {
              try {
                  $this->socket = $this->createServerSocket();
                  $this->updatePort();
      Severity: Minor
      Found in src/Executor/Server.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

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

          public function __construct(string $message = "", int $code = 0, ?Throwable $previous = null)
          {
              if (function_exists('debug_backtrace')) {
                  $trace = debug_backtrace();
                  foreach ($trace as $t) {
      Severity: Minor
      Found in src/Exception/Exception.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 fetch has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function fetch(string $url, string $method = 'get', array $headers = [], ?string $body = null, ?array &$info = null, bool $nothrow = false): string
      Severity: Minor
      Found in src/functions.php - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                    while (!preg_match('/^]/', $line)) {
                                        $multiLineArray .= $line . "\n";
                                        $line = $lines[++$i];
                                    }
        Severity: Major
        Found in src/Documentation/DocRecipe.php - About 45 mins to fix

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

              private function outputTree(string $taskName)
              {
                  $this->output->writeln("The task-tree for <info>$taskName</info>:");
          
                  /**
          Severity: Minor
          Found in src/Command/TreeCommand.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

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

          function askChoice(string $message, array $availableChoices, $default = null, bool $multiselect = false)
          {
              if (defined('DEPLOYER_NO_ASK')) {
                  throw new WillAskUser($message);
              }
          Severity: Minor
          Found in src/functions.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

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

          function artisan($command, $options = [])
          {
              return function () use ($command, $options) {
          
                  // Ensure the artisan command is available on the current version.
          Severity: Minor
          Found in recipe/laravel.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

          Function run has a Cognitive Complexity of 8 (exceeds 5 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: Minor
          Found in src/Ssh/SshClient.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

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

          function spark($command, $options = [])
          {
              return function () use ($command, $options) {
          
                  // Ensure the spark command is available on the current version.
          Severity: Minor
          Found in recipe/codeigniter4.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

          Consider simplifying this complex logical expression.
          Open

              if (!is_array($config) ||
                  !isset($config['host']) ||
                  !isset($config['port']) ||
                  !isset($config['username']) ||
                  !isset($config['token']) ||
          Severity: Major
          Found in contrib/cpanel.php - About 40 mins to fix

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

                    Host $host,
                    string $command,
                    int $exitCode,
                    string $output,
                    string $errorOutput,
            Severity: Minor
            Found in src/Exception/RunException.php - About 35 mins to fix

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

              function option(string $name, $shortcut = null, ?int $mode = null, string $description = '', $default = null): void
              Severity: Minor
              Found in src/functions.php - About 35 mins to fix

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

                        int $major = 0,
                        int $minor = 0,
                        int $patch = 0,
                        array $pre = [],
                        array $build = [],
                Severity: Minor
                Found in src/Component/PharUpdate/Version/Version.php - About 35 mins to fix

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

                  function host(string ...$hostname)
                  {
                      $deployer = Deployer::get();
                      if (count($hostname) === 1 && $deployer->hosts->has($hostname[0])) {
                          return $deployer->hosts->get($hostname[0]);
                  Severity: Minor
                  Found in src/functions.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

                  Severity
                  Category
                  Status
                  Source
                  Language