owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

Function registerDefaultActions has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        registerDefaultActions: function (excludeActions) {
            excludeActions = excludeActions || [];

            var self = this;
            var defaultActions = [
Severity: Major
Found in apps/files/js/fileactions.js - About 2 hrs to fix

    Function _initXHRData has 73 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            _initXHRData: function (options) {
                var that = this,
                    formData,
                    file = options.files[0],
                    // Ignore non-multipart setting if not supported:
    Severity: Major
    Found in apps/files/js/jquery.fileupload.js - About 2 hrs to fix

      Method sendInternalShareMail has 73 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function sendInternalShareMail($sender, $node, $shareType, $recipientList): array {
              if ($this->config->getAppValue('core', 'shareapi_allow_mail_notification', 'no') !== 'yes') {
                  $message_t = $this->l->t('Internal mail notification for shared files is not allowed');
                  throw new GenericShareException($message_t, $message_t, 403);
              }
      Severity: Major
      Found in lib/private/Share/MailNotifications.php - About 2 hrs to fix

        Method getItemSharedWithUser has 73 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function getItemSharedWithUser($itemType, $itemSource, $user, $owner = null, $shareType = null) {
                $shares = [];
                $fileDependent = false;
        
                $where = 'WHERE';
        Severity: Major
        Found in lib/private/Share/Share.php - About 2 hrs to fix

          Method mergeResponses has 73 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function mergeResponses($responses) {
                  // Sort into shipped and third-party
                  $shipped = [
                      'succeeded' => [],
                      'failed' => [],
          Severity: Major
          Found in lib/private/legacy/api.php - About 2 hrs to fix

            Function getPermissionsFromRequest has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                private function getPermissionsFromRequest() {
                    // int-based permissions are set -> use them
                    $permissions = $this->request->getParam('permissions', null);
                    if ($permissions !== null) {
                        return $permissions;
            Severity: Minor
            Found in apps/files_sharing/lib/Controller/Share20OcsController.php - About 2 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 move2trash has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function move2trash($file_path) {
                    // get the user for which the filesystem is setup
                    $root = Filesystem::getRoot();
                    list(, $user) = \explode('/', $root);
                    list($owner, $ownerPath) = self::getUidAndFilename($file_path);
            Severity: Minor
            Found in apps/files_trashbin/lib/Trashbin.php - About 2 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 xmlDeserialize has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function xmlDeserialize(Reader $reader) {
                    $elems = (array)$reader->parseInnerTree([
                        '{DAV:}prop' => KeyValue::class,
                        '{http://owncloud.org/ns}filter-rules' => Base::class,
                        '{http://owncloud.org/ns}search' => KeyValue::class,
            Severity: Minor
            Found in apps/dav/lib/Files/Xml/FilterRequest.php - About 2 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 buildPolicy has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                public function buildPolicy() {
                    $policy = "default-src 'none';manifest-src 'self';";
            
                    if (!empty($this->allowedScriptDomains) || $this->inlineScriptAllowed || $this->evalScriptAllowed) {
                        $policy .= 'script-src ';
            Severity: Minor
            Found in lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php - About 2 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 buildParts has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function buildParts(array $data) {
                    $fields = [
                        'path', 'parent', 'name', 'mimetype', 'size', 'mtime', 'storage_mtime', 'encrypted',
                        'etag', 'permissions', 'checksum'];
            
            
            Severity: Minor
            Found in lib/private/Files/Cache/Cache.php - About 2 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 doAppUpgrade has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function doAppUpgrade() {
                    $apps = \OC_App::getEnabledApps();
                    $priorityTypes = ['authentication', 'filesystem', 'logging'];
                    $pseudoOtherType = 'other';
                    $stacks = [$pseudoOtherType => []];
            Severity: Minor
            Found in lib/private/Updater.php - About 2 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 handleChildren has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                private function handleChildren($path, $recursive, $reuse, $folderId, $lock, &$size) {
                    // we put this in it's own function so it cleans up the memory before we start recursing
                    $existingChildren = $this->getExistingChildren($folderId);
                    $newChildren = $this->getNewChildren($path);
            
            
            Severity: Minor
            Found in lib/private/Files/Cache/Scanner.php - About 2 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 createSelectStatement has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                private static function createSelectStatement($format, $fileDependent, $uidOwner = null) {
                    $select = '*';
                    if ($format == self::FORMAT_STATUSES) {
                        if ($fileDependent) {
                            $select = '`*PREFIX*share`.`id`, `*PREFIX*share`.`parent`, `share_type`, `path`, `storage`, '
            Severity: Minor
            Found in lib/private/Share/Share.php - About 2 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 afterException has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                public function afterException($controller, $methodName, \Exception $exception) {
                    $headers = [];
                    if ($controller instanceof OCSController) {
                        if ($this->request->getHeader('OC-RequestAppPassword') === 'true'
                                && ($exception instanceof NotLoggedInException || $exception instanceof LoginException)) {
            Severity: Minor
            Found in lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php - About 2 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 execute has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function execute(InputInterface $input, OutputInterface $output): int {
                    $uid = $input->getArgument('uid');
                    if ($this->userManager->userExists($uid)) {
                        $output->writeln('<error>The user "' . $uid . '" already exists.</error>');
                        return 1;
            Severity: Minor
            Found in core/Command/User/Add.php - About 2 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 ia.js has 288 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            OC.L10N.register(
                "core",
                {
                "Please select a file." : "Per favor, selige un file.",
                "File is too big" : "Le file es troppo grande",
            Severity: Minor
            Found in core/l10n/ia.js - About 2 hrs to fix

              File AppRegistryController.php has 288 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /**
               * @author Thomas Müller <thomas.mueller@tmit.eu>
               *
               * @copyright Copyright (c) 2023, ownCloud GmbH
              Severity: Minor
              Found in core/Controller/AppRegistryController.php - About 2 hrs to fix

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

                    private function init() {
                        if ($this->init) {
                            return;
                        }
                        $this->init = true;
                Severity: Major
                Found in lib/private/NavigationManager.php - About 2 hrs to fix

                  Method registerCoreProviders has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function registerCoreProviders() {
                          if ($this->registeredCoreProviders) {
                              return;
                          }
                          $this->registeredCoreProviders = true;
                  Severity: Major
                  Found in lib/private/PreviewManager.php - About 2 hrs to fix

                    Method handleRemovedUsers has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function handleRemovedUsers(array $removedUsers, InputInterface $input, OutputInterface $output, $missingAccountsAction): void {
                            if (empty($removedUsers)) {
                                $output->writeln('No removed users have been detected.');
                            } else {
                                // define some actions to be used
                    Severity: Major
                    Found in core/Command/User/SyncBackend.php - About 2 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language