deployphp/deployer

View on GitHub

Showing 143 of 189 total issues

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++) {
            [$rank] = $hand[$i];
Severity: Minor
Found in src/Command/BlackjackCommand.php - About 1 hr to fix

    Function parse has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function parse(string $expression): array
        {
            $all = [];
            foreach (explode(',', $expression) as $sub) {
                $conditions = [];
    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 complete has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
        {
            parent::complete($input, $suggestions);
            if ($input->mustSuggestArgumentValuesFor('selector')) {
                $selectors = ['all'];
    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

    Method doGetTasks has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function doGetTasks(string $name): array
        {
            if (array_key_exists($name, $this->visitedTasks)) {
                if ($this->visitedTasks[$name] >= 100) {
                    throw new Exception("Looks like a circular dependency with \"$name\" task.");
    Severity: Minor
    Found in src/Task/ScriptManager.php - About 1 hr to fix

      Method task has 31 lines of code (exceeds 25 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

        Method getTasks has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getTasks(string $name, ?string $startFrom = null, array &$skipped = []): array
            {
                $tasks = [];
                $this->visitedTasks = [];
                $allTasks = $this->doGetTasks($name);
        Severity: Minor
        Found in src/Task/ScriptManager.php - About 1 hr to fix

          Method import has 29 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

            Function importComponents has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                public function importComponents(array $components): self
                {
                    if (isset($components[Parser::BUILD])) {
                        $this->build = $components[Parser::BUILD];
                    } else {
            Severity: Minor
            Found in src/Component/PharUpdate/Version/Builder.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 recipes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                private function recipes(): array
                {
                    $recipes = [];
                    $dir = new \DirectoryIterator(__DIR__ . '/../../recipe');
                    foreach ($dir as $fileinfo) {
            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 on has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            function on($hosts, callable $callback): void
            {
                if (!is_array($hosts) && !($hosts instanceof \Traversable)) {
                    $hosts = [$hosts];
                }
            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 runTask has a Cognitive Complexity of 10 (exceeds 5 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

            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 apply has 27 lines of code (exceeds 25 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

              Method endTask has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function endTask(Task $task, bool $error = false): void
                  {
                      if (empty($this->startTime)) {
                          $this->startTime = round(microtime(true) * 1000);
                      }
              Severity: Minor
              Found in src/Executor/Messenger.php - About 1 hr to fix

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

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

                    Method markdown has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function markdown(): string
                        {
                            $output = <<<MD
                                <!-- DO NOT EDIT THIS FILE! -->
                                <!-- Instead edit src/functions.php -->
                    Severity: Minor
                    Found in src/Documentation/ApiGen.php - About 1 hr to fix

                      Method importComponents has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function importComponents(array $components): self
                          {
                              if (isset($components[Parser::BUILD])) {
                                  $this->build = $components[Parser::BUILD];
                              } else {
                      Severity: Minor
                      Found in src/Component/PharUpdate/Version/Builder.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

                          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

                            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

                            Severity
                            Category
                            Status
                            Source
                            Language