owncloud/core

View on GitHub

Showing 3,235 of 4,503 total issues

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

    public function notifyRecipients($itemSource, $itemType, $shareType, $recipient) {
        $recipientList = [];
        $sender = $this->userSession->getUser();
        if ($shareType === Share::SHARE_TYPE_USER) {
            $recipientList[] = $this->userManager->get($recipient);
Severity: Minor
Found in apps/files_sharing/lib/Controller/NotificationController.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 updateInitiatorInfo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function updateInitiatorInfo() {
        while (true) {
            $shares = $this->getMissingInitiator(1000);

            if (empty($shares)) {
Severity: Minor
Found in apps/files_sharing/lib/Migration.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 testUrl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function testUrl(IClientService $clientService, string $remote, bool $checkVersion = false, bool $throwConnectException = false): bool {
        try {
            $client = $clientService->newClient();
            $response = \json_decode($client->get(
                $remote,
Severity: Minor
Found in apps/files_sharing/lib/External/Manager.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 getParents has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getParents($itemSource, $shareWith = null, $owner = null) {
        $result = [];
        $parent = $this->getParentId($itemSource);
        while ($parent) {
            $shares = \OCP\Share::getItemSharedWithUser('folder', $parent, $shareWith, $owner);
Severity: Minor
Found in apps/files_sharing/lib/ShareBackend/Folder.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 getFreeSpace has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getFreeSpace(IUser $user) {
        $free = 0;
        $quota = \OC_Util::getUserQuota($user);
        if ($quota === FileInfo::SPACE_UNLIMITED) {
            $free = Filesystem::free_space('/');
Severity: Minor
Found in apps/files_trashbin/lib/Quota.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(IShare $share) {
        list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedWith());

        $isOwner = false;

Severity: Minor
Found in apps/federatedfilesharing/lib/FederatedShareProvider.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 addSubAdmin has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function addSubAdmin($parameters) {
        $group = $this->groupManager->get($_POST['groupid']);
        $user = $this->userManager->get($parameters['userid']);

        // Check if the user exists
Severity: Minor
Found in apps/provisioning_api/lib/Users.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 changeSchema has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function changeSchema(Schema $schema, array $options): void {
        $prefix = $options['tablePrefix'];

        if (!$schema->hasTable("{$prefix}properties")) {
            // install
Severity: Minor
Found in apps/dav/appinfo/Migrations/Version20170116170538.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 addGroup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function addGroup($parameters) {
        // Validate name
        $groupId = $this->request->getParam('groupid', '');
        if (($groupId === '') || $groupId === null || ($groupId === false)) {
            \OCP\Util::writeLog('provisioning_api', 'Group name not supplied', \OCP\Util::ERROR);
Severity: Minor
Found in apps/provisioning_api/lib/Groups.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 getSubscriptionsForUser has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getSubscriptionsForUser($principalUri) {
        $fields = \array_values($this->subscriptionPropertyMap);
        $fields[] = 'id';
        $fields[] = 'uri';
        $fields[] = 'source';
Severity: Minor
Found in apps/dav/lib/CalDAV/CalDavBackend.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() {
        $calendars = $this->caldavBackend->getCalendarsForUser($this->principalInfo['uri']);
        $objects = [];
        foreach ($calendars as $calendar) {
            $objects[] = new Calendar($this->caldavBackend, $calendar, $this->l10n);
Severity: Minor
Found in apps/dav/lib/CalDAV/CalendarHome.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 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 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 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 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 handleGetProperties has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function handleGetProperties(PropFind $propFind, \Sabre\DAV\INode $node) {
        $httpRequest = $this->server->httpRequest;

        if ($node instanceof \OCA\DAV\Connector\Sabre\Node) {
            if (!$node->getFileInfo()->isReadable()) {
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 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 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

Severity
Category
Status
Source
Language