owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

Function getStorageId has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function getStorageId() {
        if (!$this->storageId) {
            if ($this->storage === null) {
                $storage = $this->createStorage(); //FIXME: start using exceptions
                if ($storage === null) {
Severity: Minor
Found in lib/private/Files/Mount/MountPoint.php - About 45 mins 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 accept has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function accept() {
        /** @var \SplFileInfo $current */
        $current = $this->current();

        if ($current->isDir()) {
Severity: Minor
Found in lib/private/IntegrityCheck/Iterator/ExcludeFileByNameFilterIterator.php - About 45 mins 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

Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        IStoragesBackendService $backendService,
        DBConfigService $dbConfig,
        IUserSession $userSession,
        IGroupManager $groupManager,
        IUserMountCache $userMountCache,
Severity: Minor
Found in lib/private/Files/External/Service/UserGlobalStoragesService.php - About 45 mins to fix

    Method sendLinkShareMailFromBody has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function sendLinkShareMailFromBody($recipients, $subject, $htmlBody, $textBody, $from, $replyTo) {
    Severity: Minor
    Found in lib/private/Share/MailNotifications.php - About 45 mins to fix

      Function scanChildren has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function scanChildren($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $folderId = null, $lock = true) {
              if ($reuse === -1) {
                  $reuse = ($recursive === self::SCAN_SHALLOW) ? self::REUSE_ETAG | self::REUSE_SIZE : self::REUSE_ETAG;
              }
              $this->emit('\OC\Files\Cache\Scanner', 'scanFolder', [$path, $this->storageId]);
      Severity: Minor
      Found in lib/private/Files/Cache/Scanner.php - About 45 mins 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 getMountsForUser has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getMountsForUser(IUser $user, IStorageFactory $loader) {
              $mounts = [];
      
              // setUser is in UserTrait.
              /* @phan-suppress-next-line PhanUndeclaredMethod */
      Severity: Minor
      Found in lib/private/Files/External/ConfigAdapter.php - About 45 mins 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

      Method translate has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function translate($app, $text, $params, $stripPath, $highlightParams, $languageCode) {
      Severity: Minor
      Found in lib/private/Activity/Manager.php - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if (~(int)$items[$id]['permissions'] & \OCP\Constants::PERMISSION_SHARE
                                    && (int)$row['permissions'] & \OCP\Constants::PERMISSION_SHARE) {
                                    $items[$row['id']] = $items[$id];
                                    $switchedItems[$id] = $row['id'];
                                    unset($items[$id]);
        Severity: Major
        Found in lib/private/Share/Share.php - About 45 mins to fix

          Function doRepair has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function doRepair(IOutput $out) {
                  $this->dirMimeTypeId = $this->mimeLoader->getId('httpd/unix-directory');
                  $this->dirMimePartId = $this->mimeLoader->getId('httpd');
          
                  if ($this->countOnly) {
          Severity: Minor
          Found in lib/private/Repair/RepairMismatchFileCachePath.php - About 45 mins 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

          Method getItemsSharedWithUser has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  $itemType,
                  $user,
                  $format = self::FORMAT_NONE,
                  $parameters = null,
                  $limit = -1,
          Severity: Minor
          Found in lib/private/Share/Share.php - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if ($item['permissions'] & ~$permissions) {
                                        // Add to list of items that need permissions removed
                                        $ids[] = $item['id'];
                                        $parents[] = $item['id'];
                                    }
            Severity: Major
            Found in lib/private/Share/Share.php - About 45 mins to fix

              Method getItemSharedWithBySource has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      $itemType,
                      $itemSource,
                      $format = self::FORMAT_NONE,
                      $parameters = null,
                      $includeCollections = false,
              Severity: Minor
              Found in lib/private/Share/Share.php - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if ($items[$id]['share_type'] != self::SHARE_TYPE_GROUP) {
                                            $items[$id]['share_type'] = self::SHARE_TYPE_GROUP;
                                            $items[$id]['share_with'] = $row['share_with'];
                                        }
                Severity: Major
                Found in lib/private/Share/Share.php - About 45 mins to fix

                  Method fixEntryParent has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      private function fixEntryParent(IOutput $out, $storageId, $fileId, $path, $wrongParentId, $parentIdExists = false) {
                  Severity: Minor
                  Found in lib/private/Repair/RepairMismatchFileCachePath.php - About 45 mins to fix

                    Function getBackend has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function getBackend($itemType) {
                            $l = \OC::$server->getL10N('lib');
                            if (isset(self::$backends[$itemType])) {
                                return self::$backends[$itemType];
                            } elseif (isset(self::$backendTypes[$itemType]['class'])) {
                    Severity: Minor
                    Found in lib/private/Share/Share.php - About 45 mins 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

                    Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            LicenseFetcher $licenseFetcher,
                            MessageService $messageService,
                            IAppManager $appManager,
                            IConfig $config,
                            ITimeFactory $timeFactory,
                    Severity: Minor
                    Found in lib/private/License/LicenseManager.php - About 45 mins to fix

                      Method getSharesBy has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          public function getSharesBy($userId, $shareType, $path = null, $reshares = false, $limit = 50, $offset = 0) {
                      Severity: Minor
                      Found in lib/private/Share20/Manager.php - About 45 mins to fix

                        Method getSharesBy has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            public function getSharesBy($userId, $shareType, $node, $reshares, $limit, $offset) {
                        Severity: Minor
                        Found in lib/private/Share20/DefaultShareProvider.php - About 45 mins to fix

                          Function resizeAndStore has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function resizeAndStore() {
                                  $image = $this->preview;
                                  if (!($image instanceof IImage)) {
                                      Util::writeLog(
                                          'core',
                          Severity: Minor
                          Found in lib/private/Preview.php - About 45 mins 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 getShareById has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function getShareById($id, $recipientId = null) {
                                  if (!ctype_digit($id)) {
                                      // share id is defined as a field of type integer
                                      // if someone calls the API asking for a share id like "abc"
                                      // then there is no point trying to query the database,
                          Severity: Minor
                          Found in lib/private/Share20/DefaultShareProvider.php - About 45 mins 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