owncloud/core

View on GitHub

Showing 3,230 of 4,482 total issues

Function initialize has 197 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    initialize: function ($el) {
        var self = this;
        var fileActions;
        if (this._initialized) {
            return;
Severity: Major
Found in apps/files_sharing/js/public.js - About 7 hrs to fix

    OC_Util has 55 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class OC_Util {
        public static $scripts = [];
        public static $styles = [];
        public static $headers = [];
        private static $rootMounted = false;
    Severity: Major
    Found in lib/private/legacy/util.php - About 7 hrs to fix

      QueryBuilder has 55 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class QueryBuilder implements IQueryBuilder {
          /** @var \OCP\IDBConnection */
          private $connection;
      
          /** @var \Doctrine\DBAL\Query\QueryBuilder */
      Severity: Major
      Found in lib/private/DB/QueryBuilder/QueryBuilder.php - About 7 hrs to fix

        File ShareesController.php has 490 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * @author Björn Schießle <bjoern@schiessle.org>
         * @author Joas Schilling <coding@schilljs.com>
         * @author Roeland Jago Douma <rullzer@owncloud.com>
        Severity: Minor
        Found in apps/files_sharing/lib/Controller/ShareesController.php - About 7 hrs to fix

          Function retainVersions has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
          Open

              private static function retainVersions($filename, $owner, $ownerPath, $timestamp, $sourceStorage = null, $forceCopy = false) {
                  if (\OCP\App::isEnabled('files_versions') && !empty($ownerPath)) {
                      $copyKeysResult = false;
          
                      // Temporary
          Severity: Minor
          Found in apps/files_trashbin/lib/Trashbin.php - About 7 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 loadField has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
          Open

              private function loadField($table, $xml) {
                  $options = ['notnull' => false];
                  $primary = null;
                  foreach ($xml->children() as $child) {
                      /**
          Severity: Minor
          Found in lib/private/DB/MDB2SchemaReader.php - About 7 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 checkServer has 189 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function checkServer(\OCP\IConfig $config) {
                  $l = \OC::$server->getL10N('lib');
                  $errors = [];
                  $CONFIG_DATADIRECTORY = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data');
          
          
          Severity: Major
          Found in lib/private/legacy/util.php - About 7 hrs to fix

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

                protected function execute(InputInterface $input, OutputInterface $output): int {
                    if ($output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL
                        && !$input->hasParameterOption('--verbose=0', true)) {
                        // set to more verbose on upgrade if no explicit verbosity was set
                        $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
            Severity: Major
            Found in core/Command/Upgrade.php - About 7 hrs to fix

              Function updateShare has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function updateShare($id) {
                      if (!$this->shareManager->shareApiEnabled()) {
                          return new Result(null, 404, $this->l->t('Share API is disabled'));
                      }
              
              
              Severity: Minor
              Found in apps/files_sharing/lib/Controller/Share20OcsController.php - About 7 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 getAllStorages has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getAllStorages() {
                      $mountPoints = $this->readLegacyConfig();
                      /**
                       * Here is the how the horribly messy mount point array looks like
                       * from the mount.json file:
              Severity: Minor
              Found in lib/private/Files/External/Service/LegacyStoragesService.php - About 7 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 Manager.php has 474 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /**
               * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
               * @author Joas Schilling <coding@schilljs.com>
               * @author Thomas Müller <thomas.mueller@tmit.eu>
              Severity: Minor
              Found in lib/private/Comments/Manager.php - About 7 hrs to fix

                Function put has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function put($data) {
                        try {
                            $exists = $this->fileView->file_exists($this->path);
                            if ($this->info && $exists && !$this->info->isUpdateable()) {
                                throw new Forbidden();
                Severity: Minor
                Found in apps/dav/lib/Connector/Sabre/File.php - About 7 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 create has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function create() {
                        $isConnectionParametersSupported = $this->isConnectionParametersSupported();
                
                        if ($config = $this->config->getValue('redis.cluster', [])) {
                            if (!\class_exists('RedisCluster')) {
                Severity: Minor
                Found in lib/private/RedisFactory.php - About 7 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 createShare has 181 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function createShare() {
                        $share = $this->shareManager->newShare();
                
                        if (!$this->shareManager->shareApiEnabled()) {
                            return new Result(null, 404, $this->l->t('Share API is disabled'));
                Severity: Major
                Found in apps/files_sharing/lib/Controller/Share20OcsController.php - About 7 hrs to fix

                  File statusmanager.js has 466 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  /**
                   * ownCloud
                   *
                   * @author Juan Pablo Villafañez Ramos <jvillafanez@owncloud.com>
                   * @author Jesus Macias Portela <jesus@owncloud.com>
                  Severity: Minor
                  Found in apps/files_external/js/statusmanager.js - About 7 hrs to fix

                    Util has 51 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class Util {
                        // consts for Logging
                        public const DEBUG=0;
                        public const INFO=1;
                        public const WARN=2;
                    Severity: Major
                    Found in lib/public/Util.php - About 7 hrs to fix

                      Method init has 179 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function init() {
                              // calculate the root directories
                              OC::$SERVERROOT = \str_replace("\\", '/', \substr(__DIR__, 0, -4));
                      
                              // register autoloader
                      Severity: Major
                      Found in lib/kernel.php - About 7 hrs to fix

                        File Users.php has 462 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        <?php
                        /**
                         * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
                         * @author Joas Schilling <coding@schilljs.com>
                         * @author Lukas Reschke <lukas@statuscode.ch>
                        Severity: Minor
                        Found in apps/provisioning_api/lib/Users.php - About 7 hrs to fix

                          Function create has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function create($username, $password, array $groups= [], $email='') {
                                  $resp = $this->validateString($username, 255);
                                  if ($resp) {
                                      return $resp;
                                  }
                          Severity: Minor
                          Found in settings/Controller/UsersController.php - About 7 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 getRemote has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
                          Open

                              protected function getRemote($search) {
                                  $this->result['remotes'] = $this->result['exact']['remotes'] = $users = [];
                          
                                  if (\strlen(\trim($search)) === 0 && $this->userSearch->getSearchMinLength() > 0) {
                                      $this->result['remotes'] = [];
                          Severity: Minor
                          Found in apps/files_sharing/lib/Controller/ShareesController.php - About 7 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

                          Severity
                          Category
                          Status
                          Source
                          Language