owncloud/core

View on GitHub

Showing 3,235 of 4,503 total issues

Function loadIndex has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    private function loadIndex($table, $xml) {
        $name = null;
        $fields = [];
        foreach ($xml->children() as $child) {
            /**
Severity: Minor
Found in lib/private/DB/MDB2SchemaReader.php - About 3 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 filepicker has 85 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    filepicker:function(title, callback, multiselect, mimetypeFilter, modal) {
        var self = this;
        // avoid opening the picker twice
        if (this.filepicker.loading) {
            return;
Severity: Major
Found in core/js/oc-dialogs.js - About 3 hrs to fix

    File sl.js has 307 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    OC.L10N.register(
        "settings",
        {
        "No user supplied" : "Ni navedenega uporabnika",
        "Authentication error" : "Napaka overjanja",
    Severity: Minor
    Found in settings/l10n/sl.js - About 3 hrs to fix

      Method getCalendarsForUser has 84 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getCalendarsForUser($principalUri) {
              $principalUriOriginal = $principalUri;
              $principalUri = $this->convertPrincipal($principalUri, true);
              $fields = \array_values($this->propertyMap);
              $fields[] = 'id';
      Severity: Major
      Found in apps/dav/lib/CalDAV/CalDavBackend.php - About 3 hrs to fix

        Method initPaths has 84 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function initPaths() {
                if (\defined('PHPUNIT_CONFIG_DIR')) {
                    self::$configDir = OC::$SERVERROOT . '/' . PHPUNIT_CONFIG_DIR . '/';
                } elseif (\defined('PHPUNIT_RUN') and PHPUNIT_RUN and \is_dir(OC::$SERVERROOT . '/tests/config/')) {
                    self::$configDir = OC::$SERVERROOT . '/tests/config/';
        Severity: Major
        Found in lib/kernel.php - About 3 hrs to fix

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

              protected function execute(InputInterface $input, OutputInterface $output): int {
                  $appId = $input->getArgument('app-id');
          
                  $checkList = new EmptyCheck();
                  foreach ($input->getOption('checker') as $checker) {
          Severity: Major
          Found in core/Command/App/CheckCode.php - About 3 hrs to fix

            Method buildCoreRoles has 84 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function buildCoreRoles(AddRolesEvent $event) {
                    $event->addRole(
                        [
                            'id' => 'core.viewer',
                            'displayName' => $this->l10n->t('Download / View'),
            Severity: Major
            Found in core/Controller/RolesController.php - About 3 hrs to fix

              File Local.php has 306 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /**
               * @author Bart Visscher <bartv@thisnet.nl>
               * @author Boris Rybalkin <ribalkin@gmail.com>
               * @author Brice Maron <brice@bmaron.net>
              Severity: Minor
              Found in lib/private/Files/Storage/Local.php - About 3 hrs to fix

                Storage has 28 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class Storage {
                    public const DEFAULTENABLED=true;
                    public const DEFAULTMAXSIZE=50; // unit: percentage; 50% of available disk space/quota
                    public const VERSIONS_ROOT = 'files_versions/';
                
                
                Severity: Minor
                Found in apps/files_versions/lib/Storage.php - About 3 hrs to fix

                  File sv.js has 305 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  OC.L10N.register(
                      "settings",
                      {
                      "No user supplied" : "Ingen användare angiven",
                      "Authentication error" : "Fel vid autentisering",
                  Severity: Minor
                  Found in settings/l10n/sv.js - About 3 hrs to fix

                    Function checkSetup has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            checkSetup: function() {
                                var deferred = $.Deferred();
                                var afterCall = function(data, statusText, xhr) {
                                    var messages = [];
                                    if (xhr.status === 200 && data) {
                    Severity: Major
                    Found in core/js/setupchecks.js - About 3 hrs to fix

                      Function fail has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                      fail: function(e, data) {
                                          var upload = self.getUpload(data);
                                          if (upload && upload.data && upload.data.stalled) {
                                              self.log('retry', e, upload);
                                              // jQuery Widget Factory uses "namespace-widgetname" since version 1.10.0:
                      Severity: Major
                      Found in apps/files/js/file-upload.js - About 3 hrs to fix

                        Method getLocks has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function getLocks($uri, $returnChildLocks) {
                                try {
                                    $node = $this->tree->getNodeForPath($uri);
                        
                                    if ($node instanceof SharedFile || $node instanceof SharedFolder) {
                        Severity: Major
                        Found in apps/dav/lib/Files/FileLocksBackend.php - About 3 hrs to fix

                          Method unshareFromSelf has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public static function unshareFromSelf($itemType, $itemOrigin, $originIsSource = false) {
                                  $originType = ($originIsSource) ? 'source' : 'target';
                                  $uid = \OCP\User::getUser();
                          
                                  if ($itemType === 'file' || $itemType === 'folder') {
                          Severity: Major
                          Found in lib/private/Share/Share.php - About 3 hrs to fix

                            Function singleSelect has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                $.fn.singleSelect = function () {
                                    return this.each(function (i, select) {
                                        var input = $('<input/>'),
                                            placement = $(select).attr('data-tooltip-placement'),
                                            inputTooltip = $(select).attr('data-inputtitle');
                            Severity: Major
                            Found in core/js/singleselect.js - About 3 hrs to fix

                              Method scanFiles has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected function scanFiles($user, $path, $verbose, OutputInterface $output, $backgroundScan = false, $shouldRepair = false) {
                                      $connection = $this->reconnectToDatabase($output);
                                      $scanner = new \OC\Files\Utils\Scanner($user, $connection, \OC::$server->getLogger());
                                      if ($shouldRepair) {
                                          $scanner->listen('\OC\Files\Utils\Scanner', 'beforeScanStorage', function ($storage) use ($output, $connection) {
                              Severity: Major
                              Found in apps/files/lib/Command/Scan.php - About 3 hrs to fix

                                Method setupDatabase has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function setupDatabase($username) {
                                        $e_host = \addslashes($this->dbHost);
                                        $e_dbname = \addslashes($this->dbName);
                                        //check if the database user has admin right
                                        if ($this->dbConnectionString !== null) {
                                Severity: Major
                                Found in lib/private/Setup/OCI.php - About 3 hrs to fix

                                  File FilesPlugin.php has 303 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 Lukas Reschke <lukas@statuscode.ch>
                                  Severity: Minor
                                  Found in apps/dav/lib/Connector/Sabre/FilesPlugin.php - About 3 hrs to fix

                                    File TransferOwnership.php has 303 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    <?php
                                    /**
                                     * @author Carla Schroder <carla@owncloud.com>
                                     * @author Joas Schilling <coding@schilljs.com>
                                     * @author Thomas Müller <thomas.mueller@tmit.eu>
                                    Severity: Minor
                                    Found in apps/files/lib/Command/TransferOwnership.php - About 3 hrs to fix

                                      File Encryption.php has 303 lines of code (exceeds 250 allowed). Consider refactoring.
                                      Open

                                      <?php
                                      /**
                                       * @author Björn Schießle <bjoern@schiessle.org>
                                       * @author jknockaert <jasper@knockaert.nl>
                                       * @author Lukas Reschke <lukas@statuscode.ch>
                                      Severity: Minor
                                      Found in lib/private/Files/Stream/Encryption.php - About 3 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language