owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

Function getFolder has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getFolder($path) {
        $files=$this->getFiles();
        $folderContent= [];
        $pathLength=\strlen($path);
        foreach ($files as $file) {
Severity: Minor
Found in lib/private/Archive/ZIP.php - About 25 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 getTagIdsForObjects has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getTagIdsForObjects($objIds, $objectType) {
        if (!\is_array($objIds)) {
            $objIds = [$objIds];
        } elseif (empty($objIds)) {
            return [];
Severity: Minor
Found in lib/private/SystemTag/SystemTagObjectMapper.php - About 25 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 getTagsByIds has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getTagsByIds($tagIds) {
        if (!\is_array($tagIds)) {
            $tagIds = [$tagIds];
        }

Severity: Minor
Found in lib/private/SystemTag/SystemTagManager.php - About 25 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 cleanPath has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function cleanPath($path) {
        if (\strlen($path) == 0 or $path[0] != '/') {
            $path = '/' . $path;
        }

Severity: Minor
Found in lib/private/Files/Storage/Common.php - About 25 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 lockPath has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function lockPath($path, $type, $lockMountPoint = false) {
        $absolutePath = $this->getAbsolutePath($path);
        $absolutePath = Filesystem::normalizePath($absolutePath);
        if (!$this->shouldLockFile($absolutePath)) {
            return false;
Severity: Minor
Found in lib/private/Files/View.php - About 25 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 addToCache has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function addToCache(ICachedMountInfo $mount) {
        if ($mount->getStorageId() !== -1) {
            try {
                $rows = $this->connection->insertIfNotExist(
                    '*PREFIX*mounts',
Severity: Minor
Found in lib/private/Files/Config/UserMountCache.php - About 25 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 scan has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true) {
        if ($reuse === -1) {
            $reuse = ($recursive === self::SCAN_SHALLOW) ? self::REUSE_ETAG | self::REUSE_SIZE : self::REUSE_ETAG;
        }
        if ($lock && $this->storage->instanceOfStorage(ILockingStorage::class)) {
Severity: Minor
Found in lib/private/Files/Cache/Scanner.php - About 25 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 getMimeType has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getMimeType($path) {
        try {
            $response = $this->propfind($path);
            if ($response === false) {
                return false;
Severity: Minor
Found in lib/private/Files/Storage/DAV.php - About 25 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 remove has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function remove($path) {
        if (!$this->enabled or Scanner::isPartialFile($path)) {
            return;
        }

Severity: Minor
Found in lib/private/Files/Cache/Updater.php - About 25 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 parseRawHeader has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function parseRawHeader($rawHeader) {
        $result = [];
        if (\substr($rawHeader, 0, \strlen(Util::HEADER_START)) === Util::HEADER_START) {
            $header = $rawHeader;
            $endAt = \strpos($header, Util::HEADER_END);
Severity: Minor
Found in lib/private/Files/Storage/Wrapper/Encryption.php - About 25 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 moveFromStorage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) {
        if ($sourceStorage === $this) {
            return $this->rename($sourceInternalPath, $targetInternalPath);
        }

Severity: Minor
Found in lib/private/Files/Storage/Common.php - About 25 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 file_get_contents has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function file_get_contents($path) {
        if ($this->encryptionManager->isEnabled() !== false) {
            $encryptionModule = $this->getEncryptionModule($path);

            if ($encryptionModule) {
Severity: Minor
Found in lib/private/Files/Storage/Wrapper/Encryption.php - About 25 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 runBackgroundScanJob has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function runBackgroundScanJob(callable $callback, $path) {
        try {
            $callback();
            \OC_Hook::emit('Scanner', 'correctFolderSize', ['path' => $path]);
            if ($this->cacheActive && $this->cache instanceof Cache) {
Severity: Minor
Found in lib/private/Files/Cache/Scanner.php - About 25 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 addStorage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function addStorage(IStorageConfig $newStorage) {
        $allStorages = $this->readConfig();

        $configId = $this->dbConfig->addMount(
            $newStorage->getMountPoint(),
Severity: Minor
Found in lib/private/Files/External/Service/StoragesService.php - About 25 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 getAbsoluteMountPoints has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getAbsoluteMountPoints($uid) {
        $mountPoints = [];

        $userGlobalStoragesService = \OC::$server->getUserGlobalStoragesService();
        '@phan-var \OC\Files\External\Service\UserGlobalStoragesService $userGlobalStoragesService';
Severity: Minor
Found in lib/private/Files/External/LegacyUtil.php - About 25 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 find has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function find($path) {
        \OC_Util::setupFS();
        $path = $this->formatPath($path);
        if (isset($this->mounts[$path])) {
            return $this->mounts[$path];
Severity: Minor
Found in lib/private/Files/Mount/Manager.php - About 25 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 verifyAppSignature has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function verifyAppSignature($appId, $path = '', $force = false) {
        try {
            if ($path === '') {
                $path = $this->appLocator->getAppPath($appId);
            }
Severity: Minor
Found in lib/private/IntegrityCheck/Checker.php - About 25 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 sendLinkShareMail has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function sendLinkShareMail($sender, $recipients, $link, $personalNote = null) {
        if ($this->config->getAppValue('core', 'shareapi_allow_public_notification', 'no') !== 'yes') {
            $message_t = $this->l->t('Public link mail notification is not allowed');
            throw new GenericShareException($message_t, $message_t, 403);
        }
Severity: Minor
Found in lib/private/Share/MailNotifications.php - About 25 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 decryptIfPassword has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function decryptIfPassword(Backend $backend, AuthMechanism $auth, $key, $value) {
        $backendParameters = $backend->getParameters();
        $authParameters = $auth->getParameters();
        if (
            (
Severity: Minor
Found in lib/private/Files/External/Service/StoragesService.php - About 25 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 unTag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

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