TikiWiki/tiki-manager

View on GitHub

Showing 2,255 of 2,255 total issues

Method postInstall has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function postInstall(array $options = [])
    {
        $access = $this->instance->getBestAccess('scripting');
        $access->getHost(); // trigger the config of the location change (to catch phpenv)

Severity: Minor
Found in src/Application/Tiki.php - About 1 hr to fix

    Method getDetails has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function getDetails($instance)
        {
            $archives = $instance->getArchives();
    
            if (count($archives) > 0) {
    Severity: Minor
    Found in src/Report/Backup.php - About 1 hr to fix

      Method cleanup has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function cleanup($instanceId, $instanceName, $maxBackups = 0)
          {
              $backup_directory = "{$instanceId}-{$instanceName}";
      
              $files = glob($_ENV['ARCHIVE_FOLDER'] . "/$backup_directory" . '/*.tar.bz2');
      Severity: Minor
      Found in src/Libs/Helpers/Archive.php - About 1 hr to fix

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

                if (empty($email) || ! filter_var($email, FILTER_VALIDATE_EMAIL)) {
                    $question = CommandHelper::getQuestion('Email address to contact');
                    $question->setValidator(function ($value) {
                        if (! filter_var($value, FILTER_VALIDATE_EMAIL)) {
                            throw new \RuntimeException('Please insert a valid email address.');
        Severity: Major
        Found in src/Command/SetupWatchManagerCommand.php and 1 other location - About 1 hr to fix
        src/Command/WatchInstanceCommand.php on lines 48..57

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

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

                if (empty($email) || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
                    $question = CommandHelper::getQuestion('Email address to contact');
                    $question->setValidator(function ($value) {
                        if (!filter_var($value, FILTER_VALIDATE_EMAIL)) {
                            throw new \RuntimeException('Please insert a valid email address.');
        Severity: Major
        Found in src/Command/WatchInstanceCommand.php and 1 other location - About 1 hr to fix
        src/Command/SetupWatchManagerCommand.php on lines 51..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 109.

        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 execute has a Cognitive Complexity of 12 (exceeds 5 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

        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 getInterpreterPath has a Cognitive Complexity of 12 (exceeds 5 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

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

            public function fixPermissions($path)
            {
                $filesystem = new Filesystem();
                $perm = $this->getFilePerm();
                $user = $this->getFileUser();
        Severity: Minor
        Found in src/Application/Backup.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 readSystemIniConfigFileFromManifest has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public function readSystemIniConfigFileFromManifest($manifest_file)
            {
                $result = [];
                $access = $this->getAccess();
                $manifest = $access->fileGetContents($manifest_file);
        Severity: Minor
        Found in src/Application/Restore.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 update has a Cognitive Complexity of 12 (exceeds 5 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: Minor
        Found in src/Libs/VersionControl/Git.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 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function execute(InputInterface $input, OutputInterface $output)
            {
                $updater = UpdateManager::getUpdater();
                $updater->setLogger($this->logger);
        
        
        Severity: Minor
        Found in src/Command/ManagerUpdateCommand.php - About 1 hr to fix

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

              protected function execute(InputInterface $input, OutputInterface $output)
              {
                  $instances = CommandHelper::getInstances();
                  $instancesInfo = CommandHelper::getInstancesInfo($instances);
                  if (isset($instancesInfo)) {
          Severity: Minor
          Found in src/Command/AccessInstanceCommand.php - About 1 hr to fix

            Method getUpgradeVersion has 35 lines of code (exceeds 25 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

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

                      foreach (explode("\n", `svn ls $this->repositoryUrl/tags`) as $line) {
                          $line = trim($line);
                          if (empty($line)) {
                              continue;
                          }
              Severity: Major
              Found in src/Libs/VersionControl/Svn.php and 1 other location - About 1 hr to fix
              src/Libs/VersionControl/Svn.php on lines 83..92

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

              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

                      foreach (explode("\n", `svn ls $this->repositoryUrl/branches`) as $line) {
                          $line = trim($line);
                          if (empty($line)) {
                              continue;
                          }
              Severity: Major
              Found in src/Libs/VersionControl/Svn.php and 1 other location - About 1 hr to fix
              src/Libs/VersionControl/Svn.php on lines 69..78

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

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

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

                Method interact has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function interact(InputInterface $input, OutputInterface $output)
                    {
                        $instances = CommandHelper::getInstances('tiki');
                
                        if (empty($input->getOption('patch'))) {
                Severity: Minor
                Found in src/Command/DeletePatchCommand.php - About 1 hr to fix

                  Method create has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function create($skipArchive = false, $backupDir = null)
                      {
                          $backupDir = $backupDir ?: $this->backupDir;
                  
                          $this->io->writeln('Checking directories...');
                  Severity: Minor
                  Found in src/Application/Backup.php - About 1 hr to fix

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

                        protected function configure()
                        {
                            $this
                                ->setName('instance:checkout')
                                ->setDescription('Checkout a different branch or revision on an underlying Git controlled source.')
                    Severity: Minor
                    Found in src/Command/CheckoutCommand.php - About 1 hr to fix

                      Method readSystemIniConfigFileFromManifest has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function readSystemIniConfigFileFromManifest($manifest_file)
                          {
                              $result = [];
                              $access = $this->getAccess();
                              $manifest = $access->fileGetContents($manifest_file);
                      Severity: Minor
                      Found in src/Application/Restore.php - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language