owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

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

    private function handleChildren($path, $recursive, $reuse, $folderId, $lock, &$size) {
Severity: Minor
Found in lib/private/Files/Cache/Scanner.php - About 45 mins to fix

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

        protected function verifyUnencryptedSize($path, $unencryptedSize) {
            $size = $this->storage->filesize($path);
            $result = $unencryptedSize;
    
            if ($unencryptedSize < 0 ||
    Severity: Minor
    Found in lib/private/Files/Storage/Wrapper/Encryption.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 normalizePath has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function normalizePath($path, $stripTrailingSlash = true, $isAbsolutePath = false, $keepUnicode = false) {
            if (self::$normalizedPathCache === null) {
                self::$normalizedPathCache = new CappedMemoryCache();
            }
    
    
    Severity: Minor
    Found in lib/private/Files/Filesystem.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 writeBack has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function writeBack($tmpFile) {
            if (!isset(self::$tmpFiles[$tmpFile])) {
                return;
            }
    
    
    Severity: Minor
    Found in lib/private/Files/ObjectStore/ObjectStoreStorage.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 backgroundScan has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function backgroundScan($dir) {
            $mounts = $this->getMounts($dir);
            foreach ($mounts as $mount) {
                if (!$this->shouldScan($mount)) {
                    continue;
    Severity: Minor
    Found in lib/private/Files/Utils/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 formatCacheEntry has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function formatCacheEntry($entry) {
            $storageId = $entry->getStorageId();
    
            // Give all permissions to whitelisted "internal" paths and their
            // subdirectories
    Severity: Minor
    Found in lib/private/Files/Cache/Wrapper/ReadOnlyCachePermissionsMask.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 getThumbnail has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getThumbnail(File $file, $maxX, $maxY, $scalingUp) {
            $useFileDirectly = (!$file->isEncrypted() && !$file->isMounted());
            if ($useFileDirectly) {
                $absPath = $file->getStorage()->getLocalFile($file->getInternalPath());
            } else {
    Severity: Minor
    Found in lib/private/Preview/MP3.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 setBackendOptions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function setBackendOptions($backendOptions) {
            if ($this->getBackend() instanceof  Backend) {
                $parameters = $this->getBackend()->getParameters();
                foreach ($backendOptions as $key => $value) {
                    if (isset($parameters[$key])) {
    Severity: Minor
    Found in lib/private/Files/External/StorageConfig.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 __construct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function __construct($storage, $mountpoint, $arguments = null, $loader = null, $mountOptions = null) {
            if ($arguments === null) {
                $arguments = [];
            }
            if ($loader === 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 addMultiple has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function addMultiple($names, $sync=false, $id = null) {
            if (!\is_array($names)) {
                $names = [$names];
            }
            $names = \array_map('trim', $names);
    Severity: Minor
    Found in lib/private/Tags.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 tagAs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function tagAs($objid, $tag) {
            if (\is_string($tag) && !\is_numeric($tag)) {
                $tag = \trim($tag);
                if ($tag === '') {
                    \OCP\Util::writeLog('core', __METHOD__.', Cannot add an empty tag', \OCP\Util::DEBUG);
    Severity: Minor
    Found in lib/private/Tags.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 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

            Severity
            Category
            Status
            Source
            Language