owncloud/core

View on GitHub

Showing 3,235 of 4,503 total issues

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 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 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 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 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 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 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 setDriveFileHelper has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function setDriveFileHelper($path, $file) {
        $path = \trim($path, '/');
        $this->driveFiles[$path] = $file;
        if ($file === false) {
            // Remove all children
Severity: Minor
Found in apps/files_external/lib/Lib/Storage/Google.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

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

    public static function postStore(string $filename) {
        if (self::metaEnabled()) {
            // we don't support versioned directories
            if (Filesystem::is_dir($filename) || !Filesystem::file_exists($filename)) {
                return false;
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 pre_renameOrCopy_hook has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function pre_renameOrCopy_hook($params) {
        if (\OCP\App::isEnabled('files_versions')) {
            // if we rename a movable mount point, then the versions don't have
            // to be renamed
            $absOldPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files' . $params['oldpath']);
Severity: Minor
Found in apps/files_versions/lib/Hooks.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 getConnection has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getConnection() {
        if ($this->client !== null) {
            return $this->client;
        }

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 getExpireList has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected static function getExpireList($time, $versions, $quotaExceeded = false) {
        $expiration = self::getExpiration();

        if ($expiration->shouldAutoExpire() && \count($versions) > 0) {
            list($toDelete, $size) = self::getAutoExpireList($time, $versions);
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 mkdir has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function mkdir($path) {
        if (!$this->is_dir($path)) {
            $parentFolder = $this->getDriveFile(\dirname($path));
            if ($parentFolder) {
                $folder = new DriveFile();
Severity: Minor
Found in apps/files_external/lib/Lib/Storage/Google.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 analyse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function analyse(OutputInterface $output) {
        $view = new View();
        $output->writeln("Analysing files of $this->sourceUser ...");
        $progress = new ProgressBar($output);
        $progress->start();
Severity: Minor
Found in apps/files/lib/Command/TransferOwnership.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 handleAuthHeaders has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected static function handleAuthHeaders() {
        //copy http auth headers for apache+php-fcgid work around
        if (isset($_SERVER['HTTP_XAUTHORIZATION']) && !isset($_SERVER['HTTP_AUTHORIZATION'])) {
            $_SERVER['HTTP_AUTHORIZATION'] = $_SERVER['HTTP_XAUTHORIZATION'];
        }
Severity: Minor
Found in lib/kernel.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