deployphp/deployer

View on GitHub

Showing 201 of 201 total issues

Method __construct has 86 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

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

    set('rsync_excludes', function () {
        $config = get('rsync');
        $excludes = $config['exclude'];
        $excludeFile = $config['exclude-file'];
        $excludesRsync = '';
    Severity: Major
    Found in contrib/rsync.php and 1 other location - About 3 hrs to fix
    contrib/rsync.php on lines 153..166

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

    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

    set('rsync_includes', function () {
        $config = get('rsync');
        $includes = $config['include'];
        $includeFile = $config['include-file'];
        $includesRsync = '';
    Severity: Major
    Found in contrib/rsync.php and 1 other location - About 3 hrs to fix
    contrib/rsync.php on lines 138..151

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

    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 23 (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 3 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 colorize_host has 80 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function colorize_host(string $alias): string
    {
        if (defined('NO_ANSI')) {
            return $alias;
        }
    Severity: Major
    Found in src/Support/helpers.php - About 3 hrs to fix

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

          public function parse(string $source): void
          {
              $comment = '';
              $params = '';
      
      
      Severity: Minor
      Found in src/Documentation/ApiGen.php - About 3 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 compareIdentifiers has a Cognitive Complexity of 22 (exceeds 5 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 3 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

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

      task('provision:mysql', function () {
          run('apt-get install -y mysql-server', ['env' => ['DEBIAN_FRONTEND' => 'noninteractive'], 'timeout' => 900]);
          run("mysql --user=\"root\" -e \"CREATE USER IF NOT EXISTS '{{db_user}}'@'0.0.0.0' IDENTIFIED BY '%secret%';\"", ['secret' => get('db_password')]);
          run("mysql --user=\"root\" -e \"CREATE USER IF NOT EXISTS '{{db_user}}'@'%' IDENTIFIED BY '%secret%';\"", ['secret' => get('db_password')]);
          run("mysql --user=\"root\" -e \"GRANT ALL PRIVILEGES ON *.* TO '{{db_user}}'@'0.0.0.0' WITH GRANT OPTION;\"");
      Severity: Major
      Found in recipe/provision/databases.php and 1 other location - About 2 hrs to fix
      recipe/provision/databases.php on lines 48..56

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

      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('provision:mariadb', function () {
          run('apt-get install -y mariadb-server', ['env' => ['DEBIAN_FRONTEND' => 'noninteractive'], 'timeout' => 900]);
          run("mysql --user=\"root\" -e \"CREATE USER IF NOT EXISTS '{{db_user}}'@'0.0.0.0' IDENTIFIED BY '%secret%';\"", ['secret' => get('db_password')]);
          run("mysql --user=\"root\" -e \"CREATE USER IF NOT EXISTS '{{db_user}}'@'%' IDENTIFIED BY '%secret%';\"", ['secret' => get('db_password')]);
          run("mysql --user=\"root\" -e \"GRANT ALL PRIVILEGES ON *.* TO '{{db_user}}'@'0.0.0.0' WITH GRANT OPTION;\"");
      Severity: Major
      Found in recipe/provision/databases.php and 1 other location - About 2 hrs to fix
      recipe/provision/databases.php on lines 37..45

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

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

          public function run(array $tasks, array $hosts, ?Planner $plan = null): int
          {
              $globalLimit = (int)$this->input->getOption('limit') ?: count($hosts);
      
              foreach ($tasks as $task) {
      Severity: Major
      Found in src/Executor/Master.php - About 2 hrs to fix

        Function collect has a Cognitive Complexity of 20 (exceeds 5 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 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 createTreeFromTaskName has a Cognitive Complexity of 19 (exceeds 5 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 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

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

        task('yammer:notify', function () {
            $params = [
                'is_rich_text' => 'true',
                'message_type' => 'announcement',
                'group_id' => get('yammer_group_id'),
        Severity: Major
        Found in contrib/yammer.php and 2 other locations - About 2 hrs to fix
        contrib/yammer.php on lines 86..102
        contrib/yammer.php on lines 105..121

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

        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 3 locations. Consider refactoring.
        Open

        task('yammer:notify:success', function () {
            $params = [
                'is_rich_text' => 'true',
                'message_type' => 'announcement',
                'group_id' => get('yammer_group_id'),
        Severity: Major
        Found in contrib/yammer.php and 2 other locations - About 2 hrs to fix
        contrib/yammer.php on lines 67..83
        contrib/yammer.php on lines 105..121

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

        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 3 locations. Consider refactoring.
        Open

        task('yammer:notify:failure', function () {
            $params = [
                'is_rich_text' => 'true',
                'message_type' => 'announcement',
                'group_id' => get('yammer_group_id'),
        Severity: Major
        Found in contrib/yammer.php and 2 other locations - About 2 hrs to fix
        contrib/yammer.php on lines 67..83
        contrib/yammer.php on lines 86..102

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

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

            public static function handValue(array $hand): int
            {
                $aces = 0;
                $value = 0;
                foreach ($hand as list($rank)) {
        Severity: Minor
        Found in src/Command/BlackjackCommand.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

        File Deployer.php has 264 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php declare(strict_types=1);
        
        /* (c) Anton Medvedev <anton@medv.io>
         *
         * For the full copyright and license information, please view the LICENSE
        Severity: Minor
        Found in src/Deployer.php - About 2 hrs to fix

          Function colorize_host has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          function colorize_host(string $alias): string
          {
              if (defined('NO_ANSI')) {
                  return $alias;
              }
          Severity: Minor
          Found in src/Support/helpers.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 doGetTasks has a Cognitive Complexity of 17 (exceeds 5 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 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

          Severity
          Category
          Status
          Source
          Language