TikiWiki/tiki-manager

View on GitHub

Showing 332 of 2,142 total issues

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

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $vcsOption = $input->getOption('vcs');
        $vcsOption = $vcsOption ? strtoupper($vcsOption) : '';
        if (! in_array($vcsOption, ['SVN', 'GIT', 'SRC'])) {
Severity: Minor
Found in src/Command/TikiVersionCommand.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 php has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

function php()
{

    if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
        $paths = `where php`;
Severity: Minor
Found in src/Libs/Helpers/functions.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 Discovery.php has 252 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/Application/Discovery.php - About 2 hrs to fix

    File SetupCloneManagerCommand.php has 251 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.
    Severity: Minor
    Found in src/Command/SetupCloneManagerCommand.php - About 2 hrs to fix

      Method setupDatabase has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function setupDatabase(Database $database)
          {
              $tmp = tempnam($_ENV['TEMP_FOLDER'], 'dblocal');
              $dbFileContents = $this->generateDbFileContent($database);
              file_put_contents($tmp, $dbFileContents);
      Severity: Minor
      Found in src/Application/Tiki.php - About 2 hrs to fix

        Method getSVNPath has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getSVNPath()
            {
                $host = $this->getHost();
        
                if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
        Severity: Minor
        Found in src/Access/Local.php - About 2 hrs to fix

          Method update has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function update(string $targetFolder, string $branch, int $lag = 0)
              {
                  $commitSHA = null;
                  $fetchOptions = [];
                  $time = time() - $lag * 60 * 60 * 24;
          Severity: Minor
          Found in src/Libs/VersionControl/Git.php - About 2 hrs to fix

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

                protected function execute(InputInterface $input, OutputInterface $output)
                {
                    $instances = CommandHelper::getInstances('tiki');
                    $instancesInfo = CommandHelper::getInstancesInfo($instances);
                    $package = $input->getOption('package');
            Severity: Minor
            Found in src/Command/ApplyPatchCommand.php - About 1 hr to fix

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

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

                    protected function execute(InputInterface $input, OutputInterface $output)
                    {
                        $instances = CommandHelper::getInstances('no-tiki');
                        $instancesInfo = CommandHelper::getInstancesInfo($instances);
                
                
                Severity: Minor
                Found in src/Command/RestoreInstanceCommand.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 getUpgradeVersion has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getUpgradeVersion(Instance $instance, bool $onlySupported, string $branch = null, Version $curVersion = null): ?Version
                    {
                        $curVersion = $curVersion ?: $instance->getLatestVersion();
                        if ($instance->getApplication()) {
                            $versions = $instance->getApplication()->getUpgradableVersions($curVersion, $onlySupported);
                Severity: Minor
                Found in src/Command/Traits/InstanceUpgrade.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 prepareArgs has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function prepareArgs($args)
                    {
                        $result = [];
                        if (is_string($args)) {
                            $args = preg_split('/  */', $args);
                Severity: Minor
                Found in src/Libs/Host/Command.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 getAvailableBranches has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getAvailableBranches()
                    {
                        $versions = [];
                        $versionsTemp = [];
                
                
                Severity: Minor
                Found in src/Libs/VersionControl/Svn.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 loadEnvironmentVariablesContainingLogic has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function loadEnvironmentVariablesContainingLogic()
                    {
                        $_ENV['TRIM_OS'] = strtoupper(substr(PHP_OS, 0, 3));
                
                        if ($_ENV['TRIM_OS'] === 'WIN') {
                Severity: Minor
                Found in src/Config/Environment.php - About 1 hr to fix

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

                      protected function execute(InputInterface $input, OutputInterface $output)
                      {
                          $this->printManagerInfo();
                  
                          $this->io->title('New Instance Setup');
                  Severity: Minor
                  Found in src/Command/CreateInstanceCommand.php - About 1 hr to fix

                    Method copyDirectories has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function copyDirectories($targets, $backupDir)
                        {
                            $access = $this->getAccess();
                            $backupDir = $backupDir ?: $this->backupDir;
                            $result = [];
                    Severity: Minor
                    Found in src/Application/Backup.php - About 1 hr to fix

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

                          public function rsync($args = [])
                          {
                              $return_val = -1;
                              if (empty($args['src']) || empty($args['dest'])) {
                                  return $return_val;
                      Severity: Minor
                      Found in src/Libs/Host/SSH.php - About 1 hr to fix

                        Function validateInstanceSelection has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function validateInstanceSelection($answer, $instances)
                            {
                                if (empty($answer)) {
                                    throw new \RuntimeException(
                                        'You must select an instance #ID'
                        Severity: Minor
                        Found in src/Command/Helper/CommandHelper.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 interact has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function interact(InputInterface $input, OutputInterface $output)
                            {
                                $instances = CommandHelper::getInstances('tiki');
                                $instances = array_filter($instances, function ($instance) {
                                    return $instance->vcs_type == 'git';
                        Severity: Minor
                        Found in src/Command/CheckoutCommand.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 getLocalCheckouts has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function getLocalCheckouts()
                            {
                                $access = $this->instance->getBestAccess('scripting');
                                $access->chdir($this->instance->webroot);
                                $command = $access->createCommand('find', ['.', '-type', 'd', '-name', '.git']);
                        Severity: Minor
                        Found in src/Application/Tiki.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