TikiWiki/tiki-manager

View on GitHub

Showing 2,085 of 2,085 total issues

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

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

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

    File Backup.php has 414 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/Backup.php - About 5 hrs to fix

      File CommandHelper.php has 403 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/Command/Helper/CommandHelper.php - About 5 hrs to fix

        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

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

        function _mysqldump_table_data($table)
        {
            $sql = "select COUNT(*) from `$table`;";
            $result = query($sql);
            $num_rows = fetch_row($result);
        Severity: Minor
        Found in scripts/tiki/mysqldump.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 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

          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

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

                protected function interact(InputInterface $input, OutputInterface $output)
                {
                    if (empty($input->getOption('instances'))) {
                        $instances = CommandHelper::getInstances();
                        $instancesInfo = CommandHelper::getInstancesInfo($instances);
            Severity: Major
            Found in src/Command/DeleteInstanceCommand.php and 1 other location - About 5 hrs to fix
            src/Command/RevertInstanceCommand.php on lines 34..56

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

            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

                protected function interact(InputInterface $input, OutputInterface $output)
                {
                    if (empty($input->getOption('instances'))) {
                        $instances = CommandHelper::getInstances();
                        $instancesInfo = CommandHelper::getInstancesInfo($instances);
            Severity: Major
            Found in src/Command/RevertInstanceCommand.php and 1 other location - About 5 hrs to fix
            src/Command/DeleteInstanceCommand.php on lines 34..56

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

            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 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 configure has 126 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

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

                          $this
                              ->setName('instance:import')
                              ->setDescription('Import instance')
                              ->setHelp('This command allows you to import instances not yet managed by Tiki Manager')
                              ->addOption(
                  Severity: Major
                  Found in src/Command/ImportInstanceCommand.php and 1 other location - About 4 hrs to fix
                  src/Command/EditInstanceCommand.php on lines 19..82

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

                  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

                          $this
                              ->setName('instance:edit')
                              ->setDescription('Edit instance')
                              ->setHelp('This command allows you to modify an instance which is managed by Tiki Manager')
                              ->addOption(
                  Severity: Major
                  Found in src/Command/EditInstanceCommand.php and 1 other location - About 4 hrs to fix
                  src/Command/ImportInstanceCommand.php on lines 27..90

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

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

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