TikiWiki/tiki-manager

View on GitHub

Showing 2,255 of 2,255 total issues

Access has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class Access
{
    private $rowid;
    private $type;
    protected $instance;
Severity: Minor
Found in src/Access/Access.php - About 2 hrs to fix

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

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

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

      if ($host_tiki) {
          $parts = explode(';', $host_tiki);
      
          $args[] = '-h' . escapeshellarg($parts[0]);
      
      
      Severity: Major
      Found in scripts/tiki/run_delete_tables.php and 3 other locations - About 2 hrs to fix
      scripts/tiki/backup_database.php on lines 30..39
      scripts/tiki/get_directory_list.php on lines 34..44
      scripts/tiki/run_sql_file.php on lines 24..34

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

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

      if ($host_tiki) {
          $parts = explode(';', $host_tiki);
      
          $args[] = '-h' . escapeshellarg($parts[0]);
      
      
      Severity: Major
      Found in scripts/tiki/run_sql_file.php and 3 other locations - About 2 hrs to fix
      scripts/tiki/backup_database.php on lines 30..39
      scripts/tiki/get_directory_list.php on lines 34..44
      scripts/tiki/run_delete_tables.php on lines 22..32

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

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

      if ($host_tiki) {
          $parts = explode(';', $host_tiki);
      
          $args[] = '-h' . escapeshellarg($parts[0]);
      
      
      Severity: Major
      Found in scripts/tiki/get_directory_list.php and 3 other locations - About 2 hrs to fix
      scripts/tiki/backup_database.php on lines 30..39
      scripts/tiki/run_delete_tables.php on lines 22..32
      scripts/tiki/run_sql_file.php on lines 24..34

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

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

      if ($host_tiki) {
          $parts = explode(';', $host_tiki);
          $args[] = '-h' . escapeshellarg($parts[0]);
      
          // Parse the MySQL port from a DSN string
      Severity: Major
      Found in scripts/tiki/backup_database.php and 3 other locations - About 2 hrs to fix
      scripts/tiki/get_directory_list.php on lines 34..44
      scripts/tiki/run_delete_tables.php on lines 22..32
      scripts/tiki/run_sql_file.php on lines 24..34

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

      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 getUpgradeVersion has a Cognitive Complexity of 16 (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 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

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

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

                    for ($i = 0, $tmp_count = strlen($login); $i < $tmp_count; $i++) {
                        if ((ord($login[$i]) >= 97) && (ord($login[$i]) <= 122)) { // 65, 90 for uppercase
                            $next = ord($login[$i]) + $key;
                            if ($next > 122) {
                                $next -= 26;
            Severity: Major
            Found in src/Ext/Password.php and 2 other locations - About 2 hrs to fix
            src/Ext/Password.php on lines 256..268
            src/Ext/Password.php on lines 289..301

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

            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

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

                    for ($i = 0, $tmp_count = strlen($login); $i < $tmp_count; $i++, $key--) {
                        if ((ord($login[$i]) >= 97) && (ord($login[$i]) <= 122)) { // 65, 90 for uppercase
                            $next = ord($login[$i]) + $key;
                            if ($next > 122) {
                                $next -= 26;
            Severity: Major
            Found in src/Ext/Password.php and 2 other locations - About 2 hrs to fix
            src/Ext/Password.php on lines 223..235
            src/Ext/Password.php on lines 256..268

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

            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

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

                    for ($i = 0, $tmp_count = strlen($login); $i < $tmp_count; $i++, $key++) {
                        if ((ord($login[$i]) >= 97) && (ord($login[$i]) <= 122)) { // 65, 90 for uppercase
                            $next = ord($login[$i]) + $key;
                            if ($next > 122) {
                                $next -= 26;
            Severity: Major
            Found in src/Ext/Password.php and 2 other locations - About 2 hrs to fix
            src/Ext/Password.php on lines 223..235
            src/Ext/Password.php on lines 289..301

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

            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 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 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 execute has 47 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 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
                    Severity
                    Category
                    Status
                    Source
                    Language