owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

Function vCard2Array has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function vCard2Array($uri, VCard $vCard) {
        $result = [
            'URI' => $uri,
        ];

Severity: Minor
Found in apps/dav/lib/CardDAV/AddressBookImpl.php - About 55 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 isExpired has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function isExpired($timestamp, $quotaExceeded = false) {
        // No expiration if disabled
        if (!$this->isEnabled()) {
            return false;
        }
Severity: Minor
Found in apps/files_versions/lib/Expiration.php - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct($params) {
        // log switch might be set already (from a subclass), so don't change it.
        if (!isset($this->logActive)) {
            $this->logActive = \OC::$server->getConfig()->getSystemValue('smb.logging.enable', false) === true;
        }
Severity: Minor
Found in apps/files_external/lib/Lib/Storage/SMB.php - About 55 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 restoreVersion has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function restoreVersion($uid, $filename, $fileToRestore, $revision) {
        if (\OC::$server->getConfig()->getSystemValue('files_versions', Storage::DEFAULTENABLED) !== true) {
            return false;
        }
        $users_view = new View('/'.$uid);
Severity: Minor
Found in apps/files_versions/lib/Storage.php - About 55 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 verifyChecksumsForFile has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function verifyChecksumsForFile($file, InputInterface $input, OutputInterface $output) {
        $path = $file->getInternalPath();
        $currentChecksums = $file->getChecksum();
        $storage = $file->getStorage();
        $storageId = $storage->getId();
Severity: Minor
Found in apps/files/lib/Command/VerifyChecksums.php - About 55 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 execute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output): int {
        $maxAge = $this->expiration->getMaxAgeAsTimestamp();
        if (!$maxAge) {
            $output->writeln("Auto expiration is configured - expiration will be handled automatically.");
            return 1;
Severity: Minor
Found in apps/files_versions/lib/Command/ExpireVersions.php - About 55 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 execute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output): int {
        $uid = $input->getArgument('uid');
        $userFolder = $this->rootFolder->getUserFolder($uid);  // might throw a NoUserException

        try {
Severity: Minor
Found in apps/files/lib/Command/CheckCache.php - About 55 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 formatFileInfo has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function formatFileInfo(FileInfo $i) {
        $entry = [];

        $entry['id'] = $i['fileid'];
        $entry['parentId'] = $i['parent'];
Severity: Minor
Found in apps/files/lib/Helper.php - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function getMimeType($path) {
        $file = $this->getDriveFile($path);
        if ($file) {
            $mimetype = $file->getMimeType();
            // Convert Google Doc mimetypes, choosing Open Document formats for download
Severity: Minor
Found in apps/files_external/lib/Lib/Storage/Google.php - About 55 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 filetype has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function filetype($path) {
        if ($this->getAbsolutePath($path) === '') {
            return 'dir';
        } else {
            $file = $this->getDriveFile($path);
Severity: Minor
Found in apps/files_external/lib/Lib/Storage/Google.php - About 55 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 execute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute($sql, array $params=[], $limit=null, $offset=null) {
        if ($this->db instanceof IDb) {
            $query = $this->db->prepareQuery($sql, $limit, $offset);
        } else {
            $query = $this->db->prepare($sql, $limit, $offset);
Severity: Minor
Found in lib/public/AppFramework/Db/Mapper.php - About 55 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 validateValue has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function validateValue(&$value) {
        switch ($this->getType()) {
            case self::VALUE_BOOLEAN:
                if (!\is_bool($value)) {
                    switch ($value) {
Severity: Minor
Found in lib/public/Files/External/DefinitionParameter.php - About 55 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 getFavoriteFilePaths has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function getFavoriteFilePaths($user) {
        $tags = $this->tagManager->load('files', [], false, $user);
        $favorites = $tags->getFavorites();

        if (empty($favorites)) {
Severity: Minor
Found in apps/files/lib/ActivityHelper.php - About 55 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 getNodeForPath has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function getNodeForPath($path) {
        $info = Filesystem::getView()->getFileInfo($path);
        if (!$info) {
            $fullPath = Filesystem::getView()->getAbsolutePath($path);
            if (isset($this->deleteMetaCache[$fullPath])) {
Severity: Minor
Found in lib/private/Files/Node/HookConnector.php - About 55 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 verifyPath has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function verifyPath($path, $fileName) {
        $l10n = \OC::$server->getL10N('lib');

        // verify empty and dot files
        $trimmed = \trim($fileName);
Severity: Minor
Found in lib/private/Files/View.php - About 55 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 deleteTags has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

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

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

    public function fopen($path, $mode) {
        $fullPath = $this->buildPath($path);
        $useExisting = true;
        switch ($mode) {
            case 'r':
Severity: Minor
Found in lib/private/Files/Storage/Flysystem.php - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function find($resources) {
        foreach ($resources as $resource) {
            try {
                $this->doFind($resource);
            } catch (ResourceNotFoundException $e) {
Severity: Minor
Found in lib/private/Template/ResourceLocator.php - About 55 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 createGroup has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function createGroup($gid) {
        if ($gid === '' || $gid === null || \trim($gid) !== $gid) {
            return false;
        } elseif ($group = $this->get($gid)) {
            return $group;
Severity: Minor
Found in lib/private/Group/Manager.php - About 55 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 getStatus has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function getStatus($file) {
        // normalize file
        $file = $this->normalize($file);

        $pathHash = \md5($file);
Severity: Minor
Found in lib/private/Files/Cache/Cache.php - About 55 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