owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

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

    private function getCacheEntry($storage, $internalPath, $relativePath) {
        $cache = $storage->getCache($internalPath);
        $data = $cache->get($internalPath);
        $watcher = $storage->getWatcher($internalPath);

Severity: Minor
Found in lib/private/Files/View.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 getSourcePath has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function getSourcePath($path) {
        $fullPath = $this->datadir . $path;
        if ($this->allowSymlinks || $path === '') {
            return $fullPath;
        }
Severity: Minor
Found in lib/private/Files/Storage/Local.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

    public function __construct($path, $storage, $internalPath, $data, $mount, $owner= null) {
Severity: Minor
Found in lib/private/Files/FileInfo.php - About 45 mins to fix

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

        private function runHooks($hooks, $path, $post = false) {
            if (empty($hooks)) {
                return true;
            }
            $relativePath = $path;
    Severity: Minor
    Found in lib/private/Files/View.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

    Avoid deeply nested control flow statements.
    Open

                                if ($extOnly && $subStorage instanceof \OCA\Files_Sharing\SharedStorage) {
                                    continue;
                                }
    Severity: Major
    Found in lib/private/Files/View.php - About 45 mins to fix

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

          protected function searchInDir($query, $dir = '') {
              $files = [];
              $physicalDir = $this->getSourcePath($dir);
              foreach (\scandir($physicalDir) as $item) {
                  if (\OC\Files\Filesystem::isIgnoredDir($item)) {
      Severity: Minor
      Found in lib/private/Files/Storage/Local.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

      Avoid deeply nested control flow statements.
      Open

                                  if ($first) {
                                      break;
                                  }
      Severity: Major
      Found in lib/private/Files/Node/Folder.php - About 45 mins to fix

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

            public function clear($prefix = '') {
                $prefix = $this->getNamespace() . $prefix;
                $allKeys = self::$cache->getAllKeys();
                if ($allKeys === false) {
                    // newer Memcached doesn't like getAllKeys(), flush everything
        Severity: Minor
        Found in lib/private/Memcache/Memcached.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

        Avoid deeply nested control flow statements.
        Open

                                    if (\hash_equals($logCondition['shared_secret'], $q['log_secret'] ?? '')) {
                                        $this->logConditionSatisfied = true;
                                        if (!empty($logCondition['logfile'])) {
                                            $logConditionFile = $logCondition['logfile'];
                                        }
        Severity: Major
        Found in lib/private/Log.php - About 45 mins to fix

          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

            Severity
            Category
            Status
            Source
            Language