TikiWiki/tiki-manager

View on GitHub

Showing 2,255 of 2,255 total issues

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

    protected function mergeWithExistingEnvironmentVariables($newEnvironmentVariables)
    {
        $env = [];

        // getenv will only return all env variables starting 7.1.0
Severity: Minor
Found in src/Libs/Host/Local.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 performUpdate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function performUpdate(Instance $instance, $version = null, $options = [])
    {
        $current = $instance->getLatestVersion();

        if (is_null($version)) {
Severity: Minor
Found in src/Application/Application.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 installNodeJsDependencies has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function installNodeJsDependencies()
    {
        if (! $this->supportsNodeJSBuild()) {
            return;
        }
Severity: Minor
Found in src/Application/Tiki.php - About 1 hr to fix

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

        public function updateInstanceTo($path, $branch)
        {
            $info = $this->info($path);
            $root = $info['repository']['root'];
            $url = $info['url'];
    Severity: Minor
    Found in src/Repository/SVN.php - About 1 hr to fix

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

          public function getInterpreterPath(TikiRequirements $requirements = null)
          {
              $instance = $this->instance;
              $detectedBinaries = $instance->phpexec ? [$instance->phpexec] : $instance->getDiscovery()->detectPHP();
      
      
      Severity: Minor
      Found in src/Access/SSH.php - About 1 hr to fix

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

            protected function configure()
            {
                parent::configure();
        
                $this
        Severity: Minor
        Found in src/Command/StatsInstanceCommand.php - About 1 hr to fix

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

              protected function configure()
              {
                  parent::configure();
          
                  $this
          Severity: Minor
          Found in src/Command/SetupBackupManagerCommand.php - About 1 hr to fix

            Method validateInstanceSelection has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function validateInstanceSelection($answer, $allInstances)
                {
                    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

              Method installComposerDependencies has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function installComposerDependencies()
                  {
                      $this->io->writeln('Installing composer dependencies... <fg=yellow>[may take a while]</>');
              
                      $instance = $this->instance;
              Severity: Minor
              Found in src/Application/Tiki.php - About 1 hr to fix

                Method getInterpreterPath has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getInterpreterPath(TikiRequirements $requirements = null)
                    {
                        $instance = $this->instance;
                        $detectedBinaries = $instance->phpexec ? [$instance->phpexec] : $instance->getDiscovery()->detectPHP();
                
                
                Severity: Minor
                Found in src/Access/Local.php - About 1 hr to fix

                  Method runCommands has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function runCommands($commands, $output = false)
                      {
                          if (!is_array($commands)) {
                              $commands = func_get_args();
                          }
                  Severity: Minor
                  Found in src/Libs/Host/Local.php - About 1 hr to fix

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

                      Method exec has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function exec($targetFolder, $toAppend)
                          {
                              static $tmpFolderChecked;
                              if ((empty($tmpFolderChecked) || !in_array(
                                  $targetFolder,
                      Severity: Minor
                      Found in src/Libs/VersionControl/Svn.php - About 1 hr to fix

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

                                if (empty($input->getOption('instance'))) {
                                    if (empty($this->instancesInfo)) {
                                        return;
                                    }
                                    CommandHelper::renderInstancesTable($output, $this->instancesInfo);
                        Severity: Major
                        Found in src/Command/TagDeleteCommand.php and 2 other locations - About 1 hr to fix
                        src/Command/TagAddOrEditCommand.php on lines 46..60
                        src/Command/TagListCommand.php on lines 46..60

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

                        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

                                if (empty($input->getOption('instance'))) {
                                    if (empty($this->instancesInfo)) {
                                        return;
                                    }
                                    CommandHelper::renderInstancesTable($output, $this->instancesInfo);
                        Severity: Major
                        Found in src/Command/TagListCommand.php and 2 other locations - About 1 hr to fix
                        src/Command/TagAddOrEditCommand.php on lines 46..60
                        src/Command/TagDeleteCommand.php on lines 46..60

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

                        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

                                if (empty($input->getOption('instance'))) {
                                    if (empty($this->instancesInfo)) {
                                        return;
                                    }
                                    CommandHelper::renderInstancesTable($output, $this->instancesInfo);
                        Severity: Major
                        Found in src/Command/TagAddOrEditCommand.php and 2 other locations - About 1 hr to fix
                        src/Command/TagDeleteCommand.php on lines 46..60
                        src/Command/TagListCommand.php on lines 46..60

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

                        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

                        The class Instance has 87 public methods and attributes. Consider reducing the number of public items to less than 45.
                        Open

                        class Instance
                        {
                            const TYPES = 'local,ftp,ssh';
                        
                            const SQL_SELECT_INSTANCE = <<<SQL
                        Severity: Minor
                        Found in src/Application/Instance.php by phpmd

                        ExcessivePublicCount

                        Since: 0.1

                        A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.

                        Example

                        public class Foo {
                            public $value;
                            public $something;
                            public $var;
                            // [... more more public attributes ...]
                        
                            public function doWork() {}
                            public function doMoreWork() {}
                            public function doWorkAgain() {}
                            // [... more more public methods ...]
                        }

                        Source https://phpmd.org/rules/codesize.html#excessivepubliccount

                        Avoid using undefined variables such as '$path' which will lead to PHP notices.
                        Open

                                    $map[$path] = $hash;
                        Severity: Minor
                        Found in src/Libs/Audit/Checksum.php by phpmd

                        UndefinedVariable

                        Since: 2.8.0

                        Detects when a variable is used that has not been defined before.

                        Example

                        class Foo
                        {
                            private function bar()
                            {
                                // $message is undefined
                                echo $message;
                            }
                        }

                        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

                        Avoid using undefined variables such as '$dbs_tiki' which will lead to PHP notices.
                        Open

                                        'dbname' => $dbs_tiki ?? '',
                        Severity: Minor
                        Found in src/Libs/Database/Database.php by phpmd

                        UndefinedVariable

                        Since: 2.8.0

                        Detects when a variable is used that has not been defined before.

                        Example

                        class Foo
                        {
                            private function bar()
                            {
                                // $message is undefined
                                echo $message;
                            }
                        }

                        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

                        Avoid using undefined variables such as '$host_tiki' which will lead to PHP notices.
                        Open

                                        'host' => $host_tiki ?? '',
                        Severity: Minor
                        Found in src/Libs/Database/Database.php by phpmd

                        UndefinedVariable

                        Since: 2.8.0

                        Detects when a variable is used that has not been defined before.

                        Example

                        class Foo
                        {
                            private function bar()
                            {
                                // $message is undefined
                                echo $message;
                            }
                        }

                        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

                        Severity
                        Category
                        Status
                        Source
                        Language