deployphp/deployer

View on GitHub

Showing 202 of 202 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

task('phinx:rollback', function () {
    $ALLOWED_OPTIONS = [
        'configuration',
        'date',
        'environment',
Severity: Major
Found in contrib/phinx.php and 1 other location - About 1 hr to fix
contrib/phinx.php on lines 148..166

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 101.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

task('phinx:migrate', function () {
    $ALLOWED_OPTIONS = [
        'configuration',
        'date',
        'environment',
Severity: Major
Found in contrib/phinx.php and 1 other location - About 1 hr to fix
contrib/phinx.php on lines 169..187

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 101.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method run has 8 arguments (exceeds 4 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
Severity: Major
Found in src/functions.php - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

        if (!is_array($config) ||
            !isset($config['channel']) ||
            !isset($config['host']) ||
            !isset($config['port']) ||
            !isset($config['username']) ||
    Severity: Major
    Found in contrib/rabbit.php - About 1 hr to fix

      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

      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 connectionOptionsArray has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public function connectionOptionsArray(): array
          {
              $options = [];
              if ($this->has('ssh_arguments')) {
                  foreach ($this->getSshArguments() as $arg) {
      Severity: Minor
      Found in src/Host/Host.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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      task('phinx:seed', function () {
          $ALLOWED_OPTIONS = [
              'configuration',
              'environment',
              'parser',
      Severity: Minor
      Found in contrib/phinx.php and 1 other location - About 55 mins to fix
      contrib/phinx.php on lines 210..227

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 98.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      task('phinx:breakpoint', function () {
          $ALLOWED_OPTIONS = [
              'configuration',
              'environment',
              'remove-all',
      Severity: Minor
      Found in contrib/phinx.php and 1 other location - About 55 mins to fix
      contrib/phinx.php on lines 190..207

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 98.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      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

        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 __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

        Avoid deeply nested control flow statements.
        Open

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

          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 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

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              task('chatwork:notify', function () {
                  if (!get('chatwork_token', false)) {
                      return;
                  }
                  
              Severity: Major
              Found in contrib/chatwork.php and 2 other locations - About 45 mins to fix
              contrib/chatwork.php on lines 142..155
              contrib/chatwork.php on lines 158..171

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 95.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              task('chatwork:notify:success', function () {
                  if (!get('chatwork_token', false)) {
                      return;
                  }
                    
              Severity: Major
              Found in contrib/chatwork.php and 2 other locations - About 45 mins to fix
              contrib/chatwork.php on lines 127..139
              contrib/chatwork.php on lines 158..171

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 95.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Severity
              Category
              Status
              Source
              Language