owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

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

    _getFile: function(mimeType, files) {
        var icon = mimeType.replace(new RegExp('/', 'g'), '-');

        // Generate path
        if (mimeType === 'dir' && $.inArray('folder', files) !== -1) {
Severity: Minor
Found in core/js/mimetype.js - 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 handleException has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function handleException($e) {
    $request = \OC::$server->getRequest();
    // in case the request content type is text/xml - we assume it's a WebDAV request
    $isXmlContentType = \strpos($request->getHeader('Content-Type') ?? '', 'text/xml');
    if ($isXmlContentType === 0) {
Severity: Minor
Found in remote.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 getSharesFromItem has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getSharesFromItem($target) {
        $result = [];
        $owner = Filesystem::getOwner($target);
        Filesystem::initMountPoints($owner);
        $info = Filesystem::getFileInfo($target);
Severity: Minor
Found in apps/files_sharing/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 canAccessShare has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function canAccessShare(IShare $share) {
        // A file with permissions 0 can't be accessed by us,
        // unless it's a rejected sub-group share in which case we want it visible to let the user accept it again
        if ($share->getPermissions() === 0
            && !($share->getShareType() === Share::SHARE_TYPE_GROUP && $share->getState() === Share::STATE_REJECTED)) {
Severity: Minor
Found in apps/files_sharing/lib/Controller/Share20OcsController.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 format has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function format(INotification $notification, L10N $l) {
        $params = $notification->getSubjectParameters();
        if ($params[0] !== $params[1] && $params[1] !== null) {
            $params[0] = $this->getUserString($params[0]);
            $params[1] = $this->getUserString($params[1]);
Severity: Minor
Found in apps/files_sharing/lib/Notifier.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 event has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function event(ManagerEvent $event) {
        $actor = $this->session->getUser();
        if ($actor instanceof IUser) {
            $actor = $actor->getUID();
        } else {
Severity: Minor
Found in apps/systemtags/lib/Activity/Listener.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 {
        $retentionEnabled = $this->trashExpiryManager->retentionEnabled();
        if (!$retentionEnabled) {
            $output->writeln("Auto expiration is configured - expiration will be handled automatically.");
            return 1;
Severity: Minor
Found in apps/files_trashbin/lib/Command/ExpireTrash.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 validateUserPass has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function validateUserPass($username, $password) {
        if (\trim($username) === '') {
            return false;
        }
        if ($this->userSession->isLoggedIn() &&
Severity: Minor
Found in apps/dav/lib/Connector/Sabre/Auth.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 check has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function check(RequestInterface $request, ResponseInterface $response) {
        $node = $this->resolveShare($request->getPath());
        if (!$node instanceof PublicSharedRootNode) {
            return [true, 'principals/system/public'];
        }
Severity: Minor
Found in apps/dav/lib/Files/PublicFiles/PublicSharingAuth.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 getDavPermissions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function getDavPermissions() {
        $node = $this->getNode();
        $p = '';
        if ($node->isDeletable() && $this->checkSharePermissions(Constants::PERMISSION_DELETE)) {
            $p .= 'D';
Severity: Minor
Found in apps/dav/lib/Files/PublicFiles/SharedNodeTrait.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 updateStorageStatus has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function updateStorageStatus(IStorageConfig &$storage, $configInput, OutputInterface $output) {
        try {
            try {
                $this->manipulateStorageConfig($storage);
            } catch (InsufficientDataForMeaningfulAnswerException $e) {
Severity: Minor
Found in apps/files_external/lib/Command/Verify.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 onReport has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function onReport($reportName, $report, $uri) {
        $reportTargetNode = $this->server->tree->getNodeForPath($uri);
        if (!$reportTargetNode instanceof Directory || $reportName !== self::REPORT_NAME) {
            return;
        }
Severity: Minor
Found in apps/dav/lib/Connector/Sabre/FilesReportPlugin.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 handleGetProperties has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function handleGetProperties(
        PropFind $propFind,
        \Sabre\DAV\INode $sabreNode
    ) {
        if (!($sabreNode instanceof \OCA\DAV\Connector\Sabre\Node)) {
Severity: Minor
Found in apps/dav/lib/Connector/Sabre/SharesPlugin.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 run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function run(IOutput $out) {
        if (!$this->config->getSystemValue('installed', false)) {
            // Skip the migration for new installations -> nothing to migrate
            return;
        }
Severity: Minor
Found in apps/files_external/appinfo/Migrations/Version20210511082903.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 updateCard has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function updateCard(VCard $vCard, IUser $user) {
        $uid = $user->getUID();
        $displayName = $user->getDisplayName();
        $displayName = empty($displayName) ? $uid : $displayName;
        $emailAddress = $user->getEMailAddress();
Severity: Minor
Found in apps/dav/lib/CardDAV/Converter.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 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

Severity
Category
Status
Source
Language