TikiWiki/tiki-manager

View on GitHub

Showing 332 of 2,142 total issues

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

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $email = $input->getOption('email');

        if (empty($email) || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
Severity: Minor
Found in src/Command/WatchInstanceCommand.php - About 5 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 configure has 139 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function configure()
    {
        parent::configure();

        $this
Severity: Major
Found in src/Command/CloneInstanceCommand.php - About 5 hrs to fix

    File functions.php has 397 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    define('DS', DIRECTORY_SEPARATOR);
    
    require_once dirname(__DIR__) . '/Requirements/Requirements.php';
    Severity: Minor
    Found in src/Libs/Helpers/functions.php - About 5 hrs to fix

      Function readManifest has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

          public function readManifest($manifestPath)
          {
              $differentInstance = $this->instance->getId() != $this->getSourceInstance()->getId();
      
              $skipPathCheck = ($this->allowCommonParents < 0) || (count(explode('/', $this->instance->webroot)) < $this->allowCommonParents);
      Severity: Minor
      Found in src/Application/Restore.php - About 5 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 execute has 135 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function execute(InputInterface $input, OutputInterface $output)
          {
              $instances = CommandHelper::getInstances('update');
              $instancesInfo = CommandHelper::getInstancesInfo($instances);
              $enableMaintenance = empty($input->getOption('no-maintenance'));
      Severity: Major
      Found in src/Command/UpdateInstanceCommand.php - About 5 hrs to fix

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

            protected function execute(InputInterface $input, OutputInterface $output)
            {
                $maxBackups = $input->getOption('max-backups') ?: Environment::get('DEFAULT_MAX_BACKUPS', 0);
                if (isset($maxBackups) && filter_var($maxBackups, FILTER_VALIDATE_INT) === false) {
                    $this->io->error('Max number of backups to keep by instance is not a number');
        Severity: Minor
        Found in src/Command/BackupInstanceCommand.php - About 5 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 restoreFolder has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
        Open

            public function restoreFolder($src, $target, $isFull = false)
            {
                $access = $this->getAccess();
                $instance = $this->instance;
                $src = rtrim($src, '/\\');
        Severity: Minor
        Found in src/Application/Restore.php - About 5 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 Environment.php has 385 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * @copyright (c) Copyright by authors of the Tiki Manager Project. All Rights Reserved.
         *     See copyright.txt for details and a complete list of authors.
         * @licence Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See LICENSE for details.
        Severity: Minor
        Found in src/Config/Environment.php - About 5 hrs to fix

          Function detectWebrootOS has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function detectWebrootOS()
              {
                  $user = $this->detectUser();
                  $domain = parse_url($this->instance->weburl)['host'];
          
          
          Severity: Minor
          Found in src/Application/Discovery/VirtualminDiscovery.php - About 5 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 restoreFolder has 127 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function restoreFolder($src, $target, $isFull = false)
              {
                  $access = $this->getAccess();
                  $instance = $this->instance;
                  $src = rtrim($src, '/\\');
          Severity: Major
          Found in src/Application/Restore.php - About 5 hrs to fix

            Method setupInstance has 119 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function setupInstance(Instance $instance, $import = false) : Instance
                {
                    $url = $this->input->getOption('url') ?: $instance->getDiscovery()->detectWeburl();
                    $url = $this->io->ask('WebUrl', $url, function ($value) {
                        if (empty($value)) {
            Severity: Major
            Found in src/Command/Traits/InstanceConfigure.php - About 4 hrs to fix

              Function restoreFilesFromFolder has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function restoreFilesFromFolder(string $srcFolder)
                  {
                      $manifest = "{$srcFolder}/manifest.txt";
                      $folders = $this->readManifest($manifest);
              
              
              Severity: Minor
              Found in src/Application/Restore.php - About 4 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 Local.php has 361 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              // Copyright (c) 2016, Avan.Tech, et. al.
              // Copyright (c) 2008, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
              // All Rights Reserved. See copyright.txt for details and a complete list of authors.
              // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
              Severity: Minor
              Found in src/Access/Local.php - About 4 hrs to fix

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

                    protected function execute(InputInterface $input, OutputInterface $output)
                    {
                        // select time handle
                        $time = $input->getOption('time');
                        CommandHelper::validateCrontabInput($time);
                Severity: Major
                Found in src/Command/SetupCloneManagerCommand.php - About 4 hrs to fix

                  Git has 35 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Git extends VersionControlSystem
                  {
                      protected const DEFAULT_GIT_REPOSITORY = 'https://gitlab.com/tikiwiki/tiki.git';
                      protected $isDefultRepository = false;
                  
                  
                  Severity: Minor
                  Found in src/Libs/VersionControl/Git.php - About 4 hrs to fix

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

                        protected function configure()
                        {
                            parent::configure();
                    
                            $this
                    Severity: Major
                    Found in src/Command/CloneAndUpgradeInstanceCommand.php - About 4 hrs to fix

                      Function runSetup has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function runSetup()
                          {
                              debug('Running Tiki Manager at ' . $_ENV['TRIM_ROOT']);
                      
                              $writableFolders = ['CACHE_FOLDER', 'TEMP_FOLDER', 'RSYNC_FOLDER', 'MOUNT_FOLDER', 'BACKUP_FOLDER', 'ARCHIVE_FOLDER', 'TRIM_LOGS', 'TRIM_DATA', 'TRIM_SRC_FOLDER'];
                      Severity: Minor
                      Found in src/Config/Environment.php - About 4 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 execute has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function execute(InputInterface $input, OutputInterface $output)
                          {
                              $currentCwd = getcwd();
                              $instancesOpt = $input->getOption('instances');
                              $excludesOpt = $input->getOption('exclude');
                      Severity: Major
                      Found in src/Command/StatsInstanceCommand.php - About 4 hrs to fix

                        File SSH.php has 338 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        <?php
                        // Copyright (c) 2016, Avan.Tech, et. al.
                        // Copyright (c) 2008, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
                        // All Rights Reserved. See copyright.txt for details and a complete list of authors.
                        // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
                        Severity: Minor
                        Found in src/Access/SSH.php - About 4 hrs to fix

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

                              protected function execute(InputInterface $input, OutputInterface $output)
                              {
                                  // select time handle
                                  $time = $input->getOption('time');
                                  CommandHelper::validateCrontabInput($time);
                          Severity: Minor
                          Found in src/Command/SetupCloneManagerCommand.php - About 4 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