owncloud/core

View on GitHub

Showing 3,229 of 4,480 total issues

File DefaultShareProvider.php has 866 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 phisch <git@philippschaffrath.de>
Severity: Major
Found in lib/private/Share20/DefaultShareProvider.php - About 2 days to fix

    Function init has a Cognitive Complexity of 94 (exceeds 5 allowed). Consider refactoring.
    Open

        init: function($uploadEl, options) {
            var self = this;
            options = options || {};
    
            this._uploads = {};
    Severity: Minor
    Found in apps/files/js/file-upload.js - About 1 day 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 scanFile has a Cognitive Complexity of 92 (exceeds 5 allowed). Consider refactoring.
    Open

        public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true) {
            // only proceed if $file is not a partial file nor a blacklisted file
            if (!self::isPartialFile($file) and !Filesystem::isFileBlacklisted($file)) {
                //acquire a lock
                if ($lock && $this->storage->instanceOfStorage(ILockingStorage::class)) {
    Severity: Minor
    Found in lib/private/Files/Cache/Scanner.php - About 1 day 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 getUsersSharingFile has a Cognitive Complexity of 92 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function getUsersSharingFile($path, $ownerUser, $includeOwner = false, $returnUserPaths = false, $recursive = true) {
            $userManager = \OC::$server->getUserManager();
            $userObject = $userManager->get($ownerUser);
    
            if ($userObject === null) {
    Severity: Minor
    Found in lib/private/Share/Share.php - About 1 day 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 Session.php has 775 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
     * @author Bernhard Posselt <dev@bernhard-posselt.com>
     * @author Christoph Wurst <christoph@owncloud.com>
    Severity: Major
    Found in lib/private/User/Session.php - About 1 day to fix

      Function init has 358 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          init: function($uploadEl, options) {
              var self = this;
              options = options || {};
      
              this._uploads = {};
      Severity: Major
      Found in apps/files/js/file-upload.js - About 1 day to fix

        File image.php has 761 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * @author Andreas Fischer <bantu@owncloud.com>
         * @author Bartek Przybylski <bart.p.pl@gmail.com>
         * @author Bart Visscher <bartv@thisnet.nl>
        Severity: Major
        Found in lib/private/legacy/image.php - About 1 day to fix

          Method getItems has 344 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function getItems(
                  $itemType,
                  $item = null,
                  $shareType = null,
                  $shareWith = null,
          Severity: Major
          Found in lib/private/Share/Share.php - About 1 day to fix

            Function log has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
            Open

                public function log($level, $message, array $context = []) {
                    $minLevel = \min($this->config->getValue('loglevel', Util::WARN), Util::FATAL);
                    $logConditions = $this->config->getValue('log.conditions', []);
                    if (empty($logConditions)) {
                        $logConditions[] = $this->config->getValue('log.condition', []);
            Severity: Minor
            Found in lib/private/Log.php - About 1 day 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 getDirectoryContent has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getDirectoryContent($directory, $mimetype_filter = '') {
                    $this->assertPathLength($directory);
                    if (!Filesystem::isValidPath($directory)) {
                        return [];
                    }
            Severity: Minor
            Found in lib/private/Files/View.php - About 1 day 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

            Server has 87 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Server extends ServerContainer implements IServerContainer, IServiceLoader {
                use EventEmitterTrait;
                /** @var string */
                private $webRoot;
            
            
            Severity: Major
            Found in lib/private/Server.php - About 1 day to fix

              View has 85 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class View {
                  use EventEmitterTrait;
                  /** @var string */
                  private $fakeRoot = '';
              
              
              Severity: Major
              Found in lib/private/Files/View.php - About 1 day to fix

                File kernel.php has 698 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                /**
                 * @author Adam Williamson <awilliam@redhat.com>
                 * @author Andreas Fischer <bantu@owncloud.com>
                 * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
                Severity: Major
                Found in lib/kernel.php - About 1 day to fix

                  File FederatedShareProvider.php has 697 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  /**
                   * @author Björn Schießle <bjoern@schiessle.org>
                   * @author Robin Appelman <icewind@owncloud.com>
                   * @author Roeland Jago Douma <rullzer@owncloud.com>
                  Severity: Major
                  Found in apps/federatedfilesharing/lib/FederatedShareProvider.php - About 1 day to fix

                    Function multiSelect has 311 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        $.fn.multiSelect=function(options) {
                            multiSelectId++;
                            var settings = {
                                'createCallback':false,
                                'createText':false,
                    Severity: Major
                    Found in core/js/multiselect.js - About 1 day to fix

                      File Trashbin.php has 683 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      /**
                       * @author Bart Visscher <bartv@thisnet.nl>
                       * @author Bastien Ho <bastienho@urbancube.fr>
                       * @author Björn Schießle <bjoern@schiessle.org>
                      Severity: Major
                      Found in apps/files_trashbin/lib/Trashbin.php - About 1 day to fix

                        File oc-dialogs.js has 677 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        /**
                         * ownCloud
                         *
                         * @author Bartek Przybylski, Christopher Schäpers, Thomas Tanghus
                         * @copyright Copyright (c) 2012 Bartek Przybylski bartek@alefzero.eu
                        Severity: Major
                        Found in core/js/oc-dialogs.js - About 1 day to fix

                          Function createShare has a Cognitive Complexity of 76 (exceeds 5 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: Minor
                          Found in apps/files_sharing/lib/Controller/Share20OcsController.php - About 1 day 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 imagebmp has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring.
                          Open

                              function imagebmp($im, $fileName = '', $bit = 24, $compression = 0) {
                                  if (!\in_array($bit, [1, 4, 8, 16, 24, 32])) {
                                      $bit = 24;
                                  } elseif ($bit == 32) {
                                      $bit = 24;
                          Severity: Minor
                          Found in lib/private/legacy/image.php - About 1 day 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 Preview.php has 665 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          <?php
                          /**
                           * @author Björn Schießle <bjoern@schiessle.org>
                           * @author Frank Karlitschek <frank@karlitschek.de>
                           * @author Georg Ehrke <georg@owncloud.com>
                          Severity: Major
                          Found in lib/private/Preview.php - About 1 day to fix
                            Severity
                            Category
                            Status
                            Source
                            Language