deployphp/deployer

View on GitHub
src/Deployer.php

Summary

Maintainability
D
2 days
Test Coverage

Method __construct has 80 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __construct(Application $console)
    {
        parent::__construct();

        /******************************
Severity: Major
Found in src/Deployer.php - About 3 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

      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 run has 35 lines of code (exceeds 25 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 1 hr to fix

        Avoid too many return statements within this method.
        Open

                    return new Messenger($c['input'], $c['output'], $c['logger']);
        Severity: Major
        Found in src/Deployer.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return 'bash -s'; // Non-login shell for localhost.
          Severity: Major
          Found in src/Deployer.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return new Importer();
            Severity: Major
            Found in src/Deployer.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return new Collection();
              Severity: Major
              Found in src/Deployer.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return new ProcessRunner($c['pop'], $c['logger']);
                Severity: Major
                Found in src/Deployer.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return 'bash -ls';
                  Severity: Major
                  Found in src/Deployer.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return new Master(
                                    $c['hosts'],
                                    $c['input'],
                                    $c['output'],
                                    $c['messenger'],
                    Severity: Major
                    Found in src/Deployer.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return !empty($this['log'])
                                      ? new FileHandler($this['log'])
                                      : new NullHandler();
                      Severity: Major
                      Found in src/Deployer.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    return new Printer($c['output']);
                        Severity: Major
                        Found in src/Deployer.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return new Rsync($c['pop'], $c['output']);
                          Severity: Major
                          Found in src/Deployer.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                        return new HostCollection();
                            Severity: Major
                            Found in src/Deployer.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                          return new ScriptManager($c['tasks']);
                              Severity: Major
                              Found in src/Deployer.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                            return new Selector($c['hosts']);
                                Severity: Major
                                Found in src/Deployer.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                              return new Logger($this['log_handler']);
                                  Severity: Major
                                  Found in src/Deployer.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                return new SshClient($c['output'], $c['pop'], $c['logger']);
                                    Severity: Major
                                    Found in src/Deployer.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                                  return new TaskCollection();
                                      Severity: Major
                                      Found in src/Deployer.php - About 30 mins to fix

                                        There are no issues that match your filters.

                                        Category
                                        Status