owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

Function canUserUseStaticTagInGroup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function canUserUseStaticTagInGroup(ISystemTag $tag, IUser $user) {
        if ($this->groupManager->isAdmin($user->getUID())) {
            return true;
        }
        if ($tag->isUserEditable() === false) {
Severity: Minor
Found in lib/private/SystemTag/SystemTagManager.php - About 35 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 hash has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function hash($type, $path, $raw = false) {
        $postFix = (\substr($path, -1, 1) === '/') ? '/' : '';
        $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path));
        if (Filesystem::isValidPath($path)) {
            $path = $this->getRelativePath($absolutePath);
Severity: Minor
Found in lib/private/Files/View.php - About 35 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 stream_seek has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function stream_seek($offset, $whence = SEEK_SET) {
        $len = \strlen(self::$data[$this->path]);
        switch ($whence) {
            case SEEK_SET:
                if ($offset <= $len) {
Severity: Minor
Found in lib/private/Files/Stream/StaticStream.php - About 35 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 stream_open has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function stream_open($path, $mode, $options, &$opened_path) {
        $context = $this->loadContext('ocencryption');

        $this->position = 0;
        $this->cache = '';
Severity: Minor
Found in lib/private/Files/Stream/Encryption.php - About 35 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 touch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function touch($path, $mtime = null) {
        if ($mtime !== null and !\is_numeric($mtime)) {
            $mtime = \strtotime($mtime);
        }

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

    public function getRelativePath($path) {
        $this->assertPathLength($path);
        if ($this->fakeRoot == '') {
            return $path;
        }
Severity: Minor
Found in lib/private/Files/View.php - About 35 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 canUserAssignTag has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function canUserAssignTag(ISystemTag $tag, IUser $user) {
        // early check to avoid unneeded group lookups
        if ($tag->isUserAssignable() && $tag->isUserVisible()) {
            return true;
        }
Severity: Minor
Found in lib/private/SystemTag/SystemTagManager.php - About 35 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 getStream has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getStream($path, $mode) {
        if ($mode=='r' or $mode=='rb') {
            return $this->zip->getStream($path);
        } else {
            //since we can't directly get a writable stream,
Severity: Minor
Found in lib/private/Archive/ZIP.php - About 35 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 stream_seek has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function stream_seek($offset, $whence = SEEK_SET) {
        $return = false;

        switch ($whence) {
            case SEEK_SET:
Severity: Minor
Found in lib/private/Files/Stream/Encryption.php - About 35 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 copy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function copy($path1, $path2) {
        if (!$this->isReadable($path1)) {
            return false;
        }
        if ($this->file_exists($path2)) {
Severity: Minor
Found in lib/private/Files/Storage/Wrapper/DirMask.php - About 35 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 handleChildrenMove has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function handleChildrenMove($sourceStorageId, $sourcePath, $targetStorageId, $targetPath) {
        $platformName = $this->connection->getDatabasePlatform()->getName();
        $versionString = $this->connection->getDatabaseVersionString();
        $versionArray = \explode('.', $versionString);

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

    private function shouldScan($mount) {
        $storage = $mount->getStorage();
        if ($storage === null) {
            return false;
        }
Severity: Minor
Found in lib/private/Files/Utils/Scanner.php - About 35 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 convertException has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function convertException(Exception $e, $path = '') {
        \OC::$server->getLogger()->logException($e);
        Util::writeLog('files_external', $e->getMessage(), Util::ERROR);
        if ($e instanceof ClientHttpException) {
            $this->throwByStatusCode($e->getHttpStatus(), $e, $path);
Severity: Minor
Found in lib/private/Files/Storage/DAV.php - About 35 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 simpleResponse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function simpleResponse($method, $path, $body, $expected) {
        $path = $this->cleanPath($path);
        try {
            // client request is in \OC\HTTP\Client
            /* @phan-suppress-next-line PhanUndeclaredMethod */
Severity: Minor
Found in lib/private/Files/Storage/DAV.php - About 35 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 getDirectoryListing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getDirectoryListing() {
        $dh = $this->storage->opendir($this->path);

        $entries = [];

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

    public static function isForbiddenFileOrDir($FileOrDir, $excluded = []) {
        $blacklistArray = [];
        $pathParts = [];

        // force blacklist/exclude arraylist/arrayRegex for unit tests
Severity: Minor
Found in lib/private/Files/Filesystem.php - About 35 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 getMetaData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getMetaData($path) {
        $data = $this->storage->getMetaData($path);
        if ($data === null) {
            return null;
        }
Severity: Minor
Found in lib/private/Files/Storage/Wrapper/Encryption.php - About 35 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 rename has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function rename($path1, $path2) {
        if (!$this->isReadable($path1)) {
            return false;
        }
        if ($this->file_exists($path2)) {
Severity: Minor
Found in lib/private/Files/Storage/Wrapper/DirMask.php - About 35 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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function update($path, $time = null) {
        if (!$this->enabled or Scanner::isPartialFile($path)) {
            return;
        }
        if ($time === null) {
Severity: Minor
Found in lib/private/Files/Cache/Updater.php - About 35 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 mimeTypeIcon has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function mimeTypeIcon($mimetype) {
        $this->loadAliases();

        while (isset($this->mimeTypeAlias[$mimetype])) {
            $mimetype = $this->mimeTypeAlias[$mimetype];
Severity: Minor
Found in lib/private/Files/Type/Detection.php - About 35 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