owncloud/core

View on GitHub

Showing 3,235 of 4,503 total issues

Method downloadShare has 99 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function downloadShare($token, $files = null, $path = '', $downloadStartSecret = '') {
        \OC_User::setIncognitoMode(true);

        $share = $this->shareManager->getShareByToken($token);

Severity: Major
Found in apps/files_sharing/lib/Controllers/ShareController.php - About 3 hrs to fix

    Method showShare has 98 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function showShare($token, $path = '') {
            \OC_User::setIncognitoMode(true);
    
            // Check whether share exists
            try {
    Severity: Major
    Found in apps/files_sharing/lib/Controllers/ShareController.php - About 3 hrs to fix

      File OcmController.php has 330 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * @author Viktar Dubiniuk <dubiniuk@owncloud.com>
       *
       * @copyright Copyright (c) 2018, ownCloud GmbH
      Severity: Minor
      Found in apps/federatedfilesharing/lib/Controller/OcmController.php - About 3 hrs to fix

        Method __construct has 98 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function __construct($renderAs, $appId = '') {
                // yes - should be injected ....
                $this->config = \OC::$server->getConfig();
        
                // Decide which page we show
        Severity: Major
        Found in lib/private/TemplateLayout.php - About 3 hrs to fix

          Method imagebmp has 98 lines of code (exceeds 25 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: Major
          Found in lib/private/legacy/image.php - About 3 hrs to fix

            Function writeBack has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

                public function writeBack($tmpFile) {
                    if (isset(self::$tempFiles[$tmpFile])) {
                        $path = self::$tempFiles[$tmpFile];
                        $parentFolder = $this->getDriveFile(\dirname($path));
                        if ($parentFolder) {
            Severity: Minor
            Found in apps/files_external/lib/Lib/Storage/Google.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 getSharesBy has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getSharesBy($userId, $shareType, $path = null, $reshares = false, $limit = 50, $offset = 0) {
                    if ($path !== null &&
                            !($path instanceof \OCP\Files\File) &&
                            !($path instanceof \OCP\Files\Folder)) {
                        throw new \InvalidArgumentException('invalid path');
            Severity: Minor
            Found in lib/private/Share20/Manager.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 enableApp has 97 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                enableApp:function(appId, active, element, groups) {
                    var self = this;
                    OC.Settings.Apps.hideErrorMessage(appId);
                    groups = groups || [];
                    var appItem = $('div#app-'+appId+'');
            Severity: Major
            Found in settings/js/admin-apps.js - About 3 hrs to fix

              Function _makeFilesFromShares has 97 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      _makeFilesFromShares: function(data) {
                          /* jshint camelcase: false */
                          var self = this;
                          var files = data;
              
              
              Severity: Major
              Found in apps/files_sharing/js/sharedfilelist.js - About 3 hrs to fix

                Method createShare has 97 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function createShare(\OCP\Share\IShare $share) {
                        $this->canShare($share);
                
                        // Verify if there are any issues with the path
                        $this->pathCreateChecks($share->getNode());
                Severity: Major
                Found in lib/private/Share20/Manager.php - About 3 hrs to fix

                  File TroubleshootTransferOwnership.php has 328 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  /**
                   * @author Piotr Mrowczynski <piotr@owncloud.com>
                   *
                   * @copyright Copyright (c) 2020, ownCloud GmbH
                  Severity: Minor
                  Found in apps/files/lib/Command/TroubleshootTransferOwnership.php - About 3 hrs to fix

                    File files.js has 327 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    /*
                     * Copyright (c) 2014
                     *
                     * This file is licensed under the Affero General Public License version 3
                     * or later.
                    Severity: Minor
                    Found in apps/files/js/files.js - About 3 hrs to fix

                      File SettingsManager.php has 327 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      /**
                       * @author Tom Needham <tom@owncloud.com>
                       *
                       * @copyright Copyright (c) 2018, ownCloud GmbH
                      Severity: Minor
                      Found in lib/private/Settings/SettingsManager.php - About 3 hrs to fix

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

                            public function create($username, $password, array $groups= [], $email='') {
                                $resp = $this->validateString($username, 255);
                                if ($resp) {
                                    return $resp;
                                }
                        Severity: Major
                        Found in settings/Controller/UsersController.php - About 3 hrs to fix

                          Method getMessageForLicense has 96 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function getMessageForLicense(array $info, string $language = null): array {
                                  $l = $this->l10nFactory->get('core', $language);
                          
                                  // check if present
                                  if ($info['licenseState'] === ILicenseManager::LICENSE_STATE_MISSING) {
                          Severity: Major
                          Found in lib/private/License/MessageService.php - About 3 hrs to fix

                            SMB has 31 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            class SMB extends StorageAdapter {
                                /** @var bool */
                                protected $logActive;
                            
                                /**
                            Severity: Minor
                            Found in apps/files_external/lib/Lib/Storage/SMB.php - About 3 hrs to fix

                              ObjectStoreStorage has 31 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              class ObjectStoreStorage extends \OC\Files\Storage\Common {
                                  /**
                                   * @var array
                                   */
                                  private static $tmpFiles = [];
                              Severity: Minor
                              Found in lib/private/Files/ObjectStore/ObjectStoreStorage.php - About 3 hrs to fix

                                DefaultShareProvider has 31 functions (exceeds 20 allowed). Consider refactoring.
                                Open

                                class DefaultShareProvider implements IShareProvider {
                                    // Special share type for user modified group shares
                                    public const SHARE_TYPE_USERGROUP = 2;
                                
                                    /** @var IDBConnection */
                                Severity: Minor
                                Found in lib/private/Share20/DefaultShareProvider.php - About 3 hrs to fix

                                  DeletedUser has 31 functions (exceeds 20 allowed). Consider refactoring.
                                  Open

                                  class DeletedUser implements IUser {
                                      /** @var Emitter */
                                      private $emitter;
                                      /** @var IConfig */
                                      private $config;
                                  Severity: Minor
                                  Found in lib/private/User/DeletedUser.php - About 3 hrs to fix

                                    RemoteUser has 31 functions (exceeds 20 allowed). Consider refactoring.
                                    Open

                                    class RemoteUser implements IUser {
                                        /** @var string */
                                        private $userId;
                                    
                                        /**
                                    Severity: Minor
                                    Found in lib/private/User/RemoteUser.php - About 3 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language