deployphp/deployer

View on GitHub

Showing 201 of 201 total issues

Method execute has 55 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

    Method run has 55 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: Major
    Found in src/Component/Ssh/Client.php - About 2 hrs to fix

      Method handValue has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function handValue(array $hand): int
          {
              $aces = 0;
              $value = 0;
              foreach ($hand as list($rank)) {
      Severity: Major
      Found in src/Command/BlackjackCommand.php - About 2 hrs to fix

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

            public function generateContribIndex(string $destination) {
                $index = "# All Contrib Recipes\n\n";
                $list = [];
                foreach ($this->recipes as $recipe) {
                    if (preg_match('/^contrib\/[^\/]+\.php$/', $recipe->recipePath)) {
        Severity: Major
        Found in src/Documentation/DocGen.php and 1 other location - About 2 hrs to fix
        src/Documentation/DocGen.php on lines 318..330

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

        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

            public function generateRecipesIndex(string $destination) {
                $index = "# All Recipes\n\n";
                $list = [];
                foreach ($this->recipes as $recipe) {
                    if (preg_match('/^recipe\/[^\/]+\.php$/', $recipe->recipePath)) {
        Severity: Major
        Found in src/Documentation/DocGen.php and 1 other location - About 2 hrs to fix
        src/Documentation/DocGen.php on lines 332..344

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

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

            public function deleteFile(): void
            {
                if ($this->file) {
                    if (file_exists($this->file)) {
                        if (false === @unlink($this->file)) {
        Severity: Minor
        Found in src/Component/PharUpdate/Update.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)
            {
                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 array_merge_alternate has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

            function array_merge_alternate(array $original, array $override)
            {
                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 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

            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

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

                  public static function import($paths)
                  {
                      if (!is_array($paths)) {
                          $paths = [$paths];
                      }
              Severity: Minor
              Found in src/Importer/Importer.php - About 1 hr to fix

                Method runTask has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function runTask(Task $task, array $hosts): int
                    {
                        if (getenv('DEPLOYER_LOCAL_WORKER') === 'true') {
                            // This allows to code coverage all recipe,
                            // as well as speedup tests by not spawning
                Severity: Minor
                Found in src/Executor/Master.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: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 164..176

                    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: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 150..162

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

                    Severity
                    Category
                    Status
                    Source
                    Language