owncloud/core

View on GitHub

Showing 4,502 of 4,502 total issues

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

    private function cleanFailedUpload(Storage $partStorage, $internalPartPath): void {
        if ($partStorage->file_exists($internalPartPath)) {
            try {
                # broken/uncompleted uploaded files shall not go into trash-bin
                if (class_exists(\OCA\Files_Trashbin\Storage::class)) {
Severity: Minor
Found in apps/dav/lib/Connector/Sabre/File.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 createFile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function createFile($name, $data = null) {
        if ($this->share->getNodeType() !== 'folder') {
            throw new Forbidden('Permission denied to create file');
        }
        $pendingFile = null;
Severity: Minor
Found in apps/dav/lib/Files/PublicFiles/PublicSharedRootNode.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 checkPropFind has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function checkPropFind($request) {
        $path = $request->getPath();
        $node = $this->server->tree->getNodeForPath($path);

        if ($node instanceof Node) {
Severity: Minor
Found in apps/dav/lib/Connector/Sabre/FilesPlugin.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 getGroupMembership has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getGroupMembership($principal, $needGroups = false) {
        list($prefix, $name) = \Sabre\Uri\split($principal);

        if ($prefix === $this->principalPrefix) {
            $user = $this->userManager->get($name);
Severity: Minor
Found in apps/dav/lib/Connector/Sabre/Principal.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 checkMove has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function checkMove($source, $destination) {
        $sourceNode = $this->tree->getNodeForPath($source);
        if (!$sourceNode instanceof Node) {
            return;
        }
Severity: Minor
Found in apps/dav/lib/Connector/Sabre/FilesPlugin.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 getACL has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getACL() {
        $acl =  [
            [
                'privilege' => '{DAV:}read',
                'principal' => $this->getOwner(),
Severity: Minor
Found in apps/dav/lib/CalDAV/Calendar.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 resolveChunkFile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function resolveChunkFile($path) {
        if (\OC_FileChunking::isWebdavChunk()) {
            // resolve to real file name to find the proper node
            list($dir, $name) = \Sabre\Uri\split($path);
            if ($dir == '/' || $dir == '.') {
Severity: Minor
Found in apps/dav/lib/Connector/Sabre/ObjectTree.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 setName has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function setName($name) {
        $mountPoint = $this->info->getMountPoint();
        // rename of a shared mount should always be possible
        if (!($mountPoint instanceof SharedMount) && !$this->info->isUpdateable()) {
            throw new \Sabre\DAV\Exception\Forbidden();
Severity: Minor
Found in apps/dav/lib/Connector/Sabre/Node.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 getChildren has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getChildren() {
        // Within a PROPFIND request we return no listing in case the share is a file drop folder
        if ($this->isFileDropFolder()
            && ($this->isPropfind() || $this->isGet())
        ) {
Severity: Minor
Found in apps/dav/lib/Files/PublicFiles/PublicSharedRootNode.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 updateShares has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function updateShares($shareable, $add, $remove) {
        foreach ($add as $element) {
            $principal = $this->findByUri($element['href']);
            if ($principal !== '') {
                $this->shareWith($shareable, $element);
Severity: Minor
Found in apps/dav/lib/DAV/Sharing/Backend.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 httpPost has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function httpPost(RequestInterface $request, ResponseInterface $response) {
        $path = $request->getPath();

        // Only handling xml
        $contentType = $request->getHeader('Content-Type');
Severity: Minor
Found in apps/dav/lib/DAV/Sharing/Plugin.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 checkPrivileges has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function checkPrivileges($uri, $privileges, $recursion = self::R_PARENT, $throwExceptions = true) {
        // within public-files throwing the exception NeedPrivileges is desired
        $shallThrowExceptions = false;
        $elements = \explode('/', $uri);
        if ($elements[0] === 'public-files') {
Severity: Minor
Found in apps/dav/lib/Connector/Sabre/DavAclPlugin.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function run(IOutput $out) {
        /** @var GlobalStoragesService $globalStoragesService */
        $globalStoragesService = \OC::$server->query('GlobalStoragesService');
        $legacyStoragesService = new LegacyStoragesService(\OC::$server->getStoragesBackendService());

Severity: Minor
Found in apps/files_external/appinfo/Migrations/Version20170814051424.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function run(IOutput $output) {
        $query = $this->connection->getQueryBuilder();
        $result = $query->selectDistinct('principaluri')
            ->from('dav_shares')
            ->execute();
Severity: Minor
Found in apps/dav/lib/Repair/RemoveInvalidShares.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 delete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function delete() {
        if ($this->path === '' || $this->path === '/' || !$this->info->isDeletable()) {
            throw new SabreForbidden();
        }

Severity: Minor
Found in apps/dav/lib/Connector/Sabre/Directory.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 validateParam has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function validateParam($key, &$value, Backend $storageBackend, AuthMechanism $authBackend) {
        $params = \array_merge($storageBackend->getParameters(), $authBackend->getParameters());
        foreach ($params as $param) {
            /** @var DefinitionParameter $param */
            if ($param->getName() === $key) {
Severity: Minor
Found in apps/files_external/lib/Command/Create.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 findByUri has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function findByUri($uri, $principalPrefix) {
        if (\substr($uri, 0, 7) === 'mailto:') {
            $email = \substr($uri, 7);
            $users = $this->userManager->getByEmail($email);
            if (\count($users) === 1) {
Severity: Minor
Found in apps/dav/lib/Connector/Sabre/Principal.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 __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct($params) {
        // Register sftp://
        Stream::register();

        $parsedHost =  $this->splitHost($params['host']);
Severity: Minor
Found in apps/files_external/lib/Lib/Storage/SFTP.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 isPublishedVersion has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected static function isPublishedVersion($view, $path) {
        if (self::metaEnabled()) {
            $versionFileInfo = $view->getFileInfo($path);
            if ($versionFileInfo) {
                $versionMetadata = self::$metaData->getVersionMetadata($versionFileInfo);
Severity: Minor
Found in apps/files_versions/lib/Storage.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 opendir has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function opendir($path) {
        try {
            $list = $this->getConnection()->nlist($this->absPath($path));
            if ($list === false) {
                return false;
Severity: Minor
Found in apps/files_external/lib/Lib/Storage/SFTP.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