owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

Method changeSchema has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function changeSchema(Schema $schema, array $options) {
        $prefix = $options['tablePrefix'];
        if (!$schema->hasTable("{$prefix}files_trash")) {
            $table = $schema->createTable("{$prefix}files_trash");
            $table->addColumn('auto_id', 'bigint', [
Severity: Major
Found in apps/files_trashbin/appinfo/Migrations/Version20170804201125.php - About 2 hrs to fix

    Method buildPolicy has 53 lines of code (exceeds 25 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: Major
    Found in lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php - About 2 hrs to fix

      Method triggerChangeHooks has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function triggerChangeHooks(IStorageConfig $oldStorage, IStorageConfig $newStorage) {
              // if mount point changed, it's like a deletion + creation
              if ($oldStorage->getMountPoint() !== $newStorage->getMountPoint()) {
                  $this->triggerHooks($oldStorage, Filesystem::signal_delete_mount);
                  $this->triggerHooks($newStorage, Filesystem::signal_create_mount);
      Severity: Major
      Found in lib/private/Files/External/Service/GlobalStoragesService.php - About 2 hrs to fix

        Method main has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function main($controllerName, $methodName, DIContainer $container, array $urlParams = null) {
                if ($urlParams !== null) {
                    $container['OCP\\IRequest']->setUrlParameters($urlParams);
                } elseif (isset($container['urlParams']) && $container['urlParams'] !== null) {
                    $container['OCP\\IRequest']->setUrlParameters($container['urlParams']);
        Severity: Major
        Found in lib/private/AppFramework/App.php - About 2 hrs to fix

          Method loadApps has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function loadApps($types = null) {
                  if (\is_array($types) && !\array_diff($types, self::$loadedTypes)) {
                      return true;
                  }
                  if (\OC::$server->getSystemConfig()->getValue('maintenance', false)) {
          Severity: Major
          Found in lib/private/legacy/app.php - About 2 hrs to fix

            File MigrationService.php has 255 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /**
             * @author Thomas Müller <thomas.mueller@tmit.eu>
             * @author Vincent Petry <pvince81@owncloud.com>
             *
            Severity: Minor
            Found in lib/private/DB/MigrationService.php - About 2 hrs to fix

              File FedShareManager.php has 254 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/FedShareManager.php - About 2 hrs to fix

                File Router.php has 254 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                /**
                 * @author Bart Visscher <bartv@thisnet.nl>
                 * @author Bernhard Posselt <dev@bernhard-posselt.com>
                 * @author Joas Schilling <coding@schilljs.com>
                Severity: Minor
                Found in lib/private/Route/Router.php - About 2 hrs to fix

                  Function _attachments has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                  $.datepicker._attachments = function (input, inst) {
                          var showOn, buttonText, buttonImage,
                              appendText = this._get(inst, "appendText"),
                              isRTL = this._get(inst, "isRTL");
                  
                  
                  Severity: Minor
                  Found in core/js/js.js - 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 submit has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                      submit: function() {
                          var self = this;
                          var data = this.data;
                          var file = this.getFile();
                  
                  
                  Severity: Minor
                  Found in apps/files/js/file-upload.js - 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 authenticate has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function authenticate($linkItem, $password = null) {
                          if ($password !== null) {
                              if ($linkItem['share_type'] == \OCP\Share::SHARE_TYPE_LINK) {
                                  // Check Password
                                  $newHash = '';
                  Severity: Minor
                  Found in apps/files_sharing/lib/Helper.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 formatItems has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function formatItems($items, $format, $parameters = null) {
                          if ($format == self::FORMAT_SHARED_STORAGE) {
                              // Only 1 item should come through for this format call
                              $item = \array_shift($items);
                              return [
                  Severity: Minor
                  Found in apps/files_sharing/lib/ShareBackend/File.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 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function execute(InputInterface $input, OutputInterface $output): int {
                          $users = $input->getArgument('user_id');
                          if (!empty($users)) {
                              foreach ($users as $user) {
                                  if ($this->userManager->userExists($user)) {
                  Severity: Minor
                  Found in apps/files_trashbin/lib/Command/CleanUp.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 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function execute(InputInterface $input, OutputInterface $output): int {
                          $output->writeln("WARNING: incoming-shares:poll has been deprecated and replaced by periodic external shares cronjob. Please check Federated Cloud Sharing settings and documentation.");
                          if ($this->externalMountProvider === null) {
                              $output->writeln("Polling is not possible when files_sharing app is disabled. Please enable it with 'occ app:enable files_sharing'");
                              return 1;
                  Severity: Minor
                  Found in apps/federatedfilesharing/lib/Command/PollIncomingShares.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 createTag has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function createTag($data, $contentType = 'application/json'): ISystemTag {
                          if (\explode(';', $contentType)[0] === 'application/json') {
                              $data = \json_decode($data, true);
                          } else {
                              throw new UnsupportedMediaType();
                  Severity: Minor
                  Found in apps/dav/lib/SystemTag/SystemTagPlugin.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 getSystemTagFileIds has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function getSystemTagFileIds($systemTagIds) {
                          $resultFileIds = null;
                  
                          // check user permissions, if applicable
                          if (!$this->isAdmin()) {
                  Severity: Minor
                  Found in apps/dav/lib/Connector/Sabre/FilesReportPlugin.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 expireOlderThanMaxForUser has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function expireOlderThanMaxForUser($uid) {
                          $expiration = self::getExpiration();
                          $threshold = $expiration->getMaxAgeAsTimestamp();
                          $versions = self::getFileHelper()->getAllVersions($uid);
                          if (!$threshold || !\array_key_exists('all', $versions)) {
                  Severity: Minor
                  Found in apps/files_versions/lib/Storage.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 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function execute(InputInterface $input, OutputInterface $output): int {
                          $pathOption = $input->getOption('path');
                          $userName = $input->getOption('user');
                  
                          $scanUserFunction = function (IUser $user) use ($input, $output) {
                  Severity: Minor
                  Found in apps/files/lib/Command/VerifyChecksums.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 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function execute(InputInterface $input, OutputInterface $output): int {
                          $users = $input->getArgument('user_id');
                          if (!empty($users)) {
                              foreach ($users as $user) {
                                  if ($this->userManager->userExists($user)) {
                  Severity: Minor
                  Found in apps/files_versions/lib/Command/CleanUp.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 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function execute(InputInterface $input, OutputInterface $output): int {
                          $sourceUserObject = $this->userManager->get($input->getArgument('source-user'));
                          $destinationUserObject = $this->userManager->get($input->getArgument('destination-user'));
                          if ($sourceUserObject === null) {
                              $output->writeln("<error>Unknown source user $this->sourceUser</error>");
                  Severity: Minor
                  Found in apps/files/lib/Command/TransferOwnership.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

                  Severity
                  Category
                  Status
                  Source
                  Language