deployphp/deployer

View on GitHub

Showing 201 of 201 total issues

Method compareIdentifiers has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function compareIdentifiers(array $left, array $right)
    {
        if ($left && empty($right)) {
            return self::LESS_THAN;
        } elseif (empty($left) && $right) {
Severity: Minor
Found in src/Component/PharUpdate/Version/Comparator.php - About 1 hr to fix

    Method execute has 43 lines of code (exceeds 25 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 1 hr to fix

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

      <?php
      namespace Deployer;
      
      require_once __DIR__ . '/common.php';
      
      
      Severity: Major
      Found in recipe/joomla.php and 1 other location - About 1 hr to fix
      recipe/wordpress.php on lines 1..16

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

      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

      <?php
      namespace Deployer;
      
      require_once __DIR__ . '/common.php';
      
      
      Severity: Major
      Found in recipe/wordpress.php and 1 other location - About 1 hr to fix
      recipe/joomla.php on lines 1..16

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

      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 selectHosts has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function selectHosts(Input $input, Output $output): array
          {
              $output->getFormatter()->setStyle('success', new OutputFormatterStyle('green'));
              if (!$output->isDecorated() && !defined('NO_ANSI')) {
                  define('NO_ANSI', 'true');
      Severity: Minor
      Found in src/Command/SelectCommand.php - About 1 hr to fix

        Method run has 40 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: Minor
        Found in src/Component/ProcessRunner/ProcessRunner.php - About 1 hr to fix

          Method getGitCommitsRefs has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function getGitCommitsRefs(): Closure
          {
              return static function ($config = []): array {
                  $previousReleaseRevision = getPreviousReleaseRevision();
                  $currentReleaseRevision = getCurrentReleaseRevision() ?: 'HEAD';
          Severity: Minor
          Found in contrib/sentry.php - About 1 hr to fix

            Method createTreeFromTaskName has 39 lines of code (exceeds 25 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 1 hr to fix

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

                  protected function execute(Input $input, Output $output): int
                  {
                      $this->deployer->input = $input;
                      $this->deployer->output = new NullOutput();
                      $hosts = $this->selectHosts($input, $output);
              Severity: Minor
              Found in src/Command/ConfigCommand.php - About 1 hr to fix

                Method printWhiskey has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function printWhiskey(int $whiskeyLevel)
                    {
                        if ($whiskeyLevel == 4) {
                            echo <<<ASCII
                
                
                Severity: Minor
                Found in src/Command/BlackjackCommand.php - About 1 hr to fix

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

                      protected function execute(InputInterface $input, OutputInterface $output): int
                      {
                          if (getenv('COLORTERM') === 'truecolor') {
                              $output->write(<<<EOF
                  ╭───────────────────────────────────────╮
                  Severity: Minor
                  Found in src/Command/InitCommand.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 getFile has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function getFile():? string
                      {
                          if (null === $this->file) {
                              unlink($this->file = tempnam(sys_get_temp_dir(), 'upd'));
                              mkdir($this->file);
                  Severity: Minor
                  Found in src/Component/PharUpdate/Update.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 findRecent has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function findRecent(Version $version, bool $major = false, bool $pre = false):? Update
                      {
                          /** @var Update|null */
                          $current = null;
                          $major = $major ? $version->getMajor() : null;
                  Severity: Minor
                  Found in src/Component/PharUpdate/Manifest.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 get has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function get(string $name, $default = null)
                      {
                          if (array_key_exists($name, $this->values)) {
                              if (is_closure($this->values[$name])) {
                                  return $this->values[$name] = $this->parse(call_user_func($this->values[$name]));
                  Severity: Minor
                  Found in src/Configuration/Configuration.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 task has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function task(string $name, $body = null): Task
                  {
                      $deployer = Deployer::get();
                  
                      if (empty($body)) {
                  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

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

                      public static function run(string $version, ?string $deployFile)
                      {
                          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

                    Method send has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function send(?array &$info = null): string
                        {
                            if($this->url === '') {
                                throw new \RuntimeException('URL must not be empty to Httpie::send()');
                            }
                    Severity: Minor
                    Found in src/Utility/Httpie.php - About 1 hr to fix

                      Method getFile has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function getFile():? string
                          {
                              if (null === $this->file) {
                                  unlink($this->file = tempnam(sys_get_temp_dir(), 'upd'));
                                  mkdir($this->file);
                      Severity: Minor
                      Found in src/Component/PharUpdate/Update.php - About 1 hr to fix

                        Method collect has 33 lines of code (exceeds 25 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/Component/Ssh/IOArguments.php - About 1 hr to fix

                          Method printHand has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function printHand(array $hand, int $offset = 1)
                              {
                                  $cards = [];
                                  for ($i = 0; $i < count($hand) - $offset; $i++) {
                                      list($rank) = $hand[$i];
                          Severity: Minor
                          Found in src/Command/BlackjackCommand.php - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language