deployphp/deployer

View on GitHub

Showing 189 of 189 total issues

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

        Function execute has a Cognitive Complexity of 15 (exceeds 5 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: Minor
        Found in src/Command/MainCommand.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 parse has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function parse(string $source): void
            {
                $comment = '';
                $params = '';
        
        
        Severity: Minor
        Found in src/Documentation/ApiGen.php - About 1 hr to fix

          Method configure has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function configure()
              {
                  parent::configure();
          
                  // Add global options defined with `option()` func.
          Severity: Minor
          Found in src/Command/MainCommand.php - About 1 hr to fix

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

            task('supervisord-monitor:start', function () {
                if (supervisordIsAuthenticated()) {
                    $names = explode(',', get('supervisord_process_name'));
                    foreach ($names as $name) {
                        $name = trim($name);
            Severity: Major
            Found in contrib/supervisord-monitor.php and 1 other location - About 1 hr to fix
            contrib/supervisord-monitor.php on lines 151..163

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

            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('supervisord-monitor:stop', function () {
                if (supervisordIsAuthenticated()) {
                    $names = explode(',', get('supervisord_process_name'));
                    foreach ($names as $name) {
                        $name = trim($name);
            Severity: Major
            Found in contrib/supervisord-monitor.php and 1 other location - About 1 hr to fix
            contrib/supervisord-monitor.php on lines 165..177

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

            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

            Function selectHosts has a Cognitive Complexity of 14 (exceeds 5 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

            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 execute has a Cognitive Complexity of 14 (exceeds 5 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

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

              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

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

                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/joomla.php and 1 other location - About 1 hr to fix
                recipe/wordpress.php on lines 1..17

                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 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/ProcessRunner/ProcessRunner.php - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language