owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

Function getChangesForCalendar has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null) {
        // Current synctoken
        $stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?');
        $stmt->execute([ $calendarId ]);
        $currentToken = $stmt->fetchColumn(0);
Severity: Minor
Found in apps/dav/lib/CalDAV/CalDavBackend.php - About 1 hr 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 create has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function create(IShare $share) {
        $shareWith = $share->getSharedWith();
        $itemSource = $share->getNodeId();
        $itemType = $share->getNodeType();
        $permissions = $share->getPermissions();
Severity: Minor
Found in apps/federatedfilesharing/lib/FederatedShareProvider.php - About 1 hr 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 getSharePermissions has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function getSharePermissions($user) {
        // check of we access a federated share
        if ($user !== null) {
            try {
                $share = $this->shareManager->getShareByToken($user);
Severity: Minor
Found in apps/dav/lib/Connector/Sabre/Node.php - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function getDavPermissions() {
        $p = '';
        if ($this->info->isShared()) {
            $p .= 'S';
        }
Severity: Minor
Found in apps/dav/lib/Connector/Sabre/Node.php - About 1 hr 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 splitUserRemote has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function splitUserRemote($address) {
        if (\strpos($address, '@') === false) {
            $hint = $this->l->t('Invalid Federated Cloud ID');
            throw new HintException('Invalid Federated Cloud ID', $hint);
        }
Severity: Minor
Found in apps/federatedfilesharing/lib/AddressHandler.php - About 1 hr 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 createShare has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function createShare(
        $shareWith,
        $name,
        $description,
        $providerId,
Severity: Minor
Found in apps/federatedfilesharing/lib/Controller/OcmController.php - About 1 hr 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 getUsersGroups has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function getUsersGroups($parameters) {
        // Check if user is logged in
        $loggedInUser = $this->userSession->getUser();
        if ($loggedInUser === null) {
            return new Result(null, API::RESPOND_UNAUTHORISED);
Severity: Minor
Found in apps/provisioning_api/lib/Users.php - About 1 hr 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 update has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function update($name, $userVisible, $userAssignable, $userEditable = false) {
        try {
            if (!$this->tagManager->canUserSeeTag($this->tag, $this->user)) {
                throw new NotFound('Tag with id ' . $this->tag->getId() . ' does not exist');
            }
Severity: Minor
Found in apps/dav/lib/SystemTag/SystemTagNode.php - About 1 hr 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 extractCollectionList has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    private function extractCollectionList($array) {
        if (isset($array['sabre']) && \is_array($array['sabre'])) {
            if (isset($array['sabre']['collections']) && \is_array($array['sabre']['collections'])) {
                if (isset($array['sabre']['collections']['collection'])) {
                    $items = $array['sabre']['collections']['collection'];
Severity: Minor
Found in apps/dav/lib/AppInfo/PluginManager.php - About 1 hr 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 updateProperties has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function updateProperties($path, INode $node, $changedProperties) {
        $existingProperties = $this->getProperties($path, $node, []);

        // TODO: use "insert or update" strategy ?
        $this->connection->beginTransaction();
Severity: Minor
Found in apps/dav/lib/DAV/MiscCustomPropertiesBackend.php - About 1 hr 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 extractPluginList has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    private function extractPluginList($array) {
        if (isset($array['sabre']) && \is_array($array['sabre'])) {
            if (isset($array['sabre']['plugins']) && \is_array($array['sabre']['plugins'])) {
                if (isset($array['sabre']['plugins']['plugin'])) {
                    $items = $array['sabre']['plugins']['plugin'];
Severity: Minor
Found in apps/dav/lib/AppInfo/PluginManager.php - About 1 hr 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 updateProperties has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function updateProperties($path, INode $node, $changedProperties) {
        $existingProperties = $this->getProperties($path, $node, []);
        '@phan-var \OCA\DAV\Connector\Sabre\Node $node';
        $fileId = $node->getId();

Severity: Minor
Found in apps/dav/lib/DAV/FileCustomPropertiesBackend.php - About 1 hr 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 getChangesForAddressBook has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel, $limit = null) {
        // Current synctoken
        $stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*addressbooks` WHERE `id` = ?');
        $stmt->execute([ $addressBookId ]);
        $currentToken = $stmt->fetchColumn();
Severity: Minor
Found in apps/dav/lib/CardDAV/CardDavBackend.php - About 1 hr 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 updateProperties has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function updateProperties($addressBookId, $cardUri, $vCardSerialized) {
        $cardId = $this->getCardId($addressBookId, $cardUri);
        $vCard = $this->readCard($vCardSerialized);

        $this->purgeProperties($addressBookId, $cardId);
Severity: Minor
Found in apps/dav/lib/CardDAV/CardDavBackend.php - About 1 hr 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

Method update has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

        $id,
        $mountPoint,
        $backend,
        $authMechanism,
        $backendOptions,
Severity: Major
Found in apps/files_external/lib/Controller/GlobalStoragesController.php - About 1 hr to fix

    Function handlePut has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function handlePut(RequestInterface $request, ResponseInterface $response) {
            if ($request->getHeader('OC-Autorename') !== '1') {
                return;
            }
    
    
    Severity: Minor
    Found in apps/dav/lib/Connector/Sabre/AutorenamePlugin.php - About 1 hr 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 syncRemoteAddressBook has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function syncRemoteAddressBook($url, $userName, $sharedSecret, $syncToken, $targetBookId, $targetPrincipal, $targetProperties) {
            // 1. create addressbook
            $book = $this->ensureSystemAddressBookExists($targetPrincipal, $targetBookId, $targetProperties);
            $addressBookId = $book['id'];
    
    
    Severity: Minor
    Found in apps/dav/lib/CardDAV/SyncService.php - About 1 hr 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 getFolderContents has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function getFolderContents($path) {
            $this->log('enter: '.__FUNCTION__."($path)");
            try {
                $path = $this->buildPath($path);
                $result = [];
    Severity: Minor
    Found in apps/files_external/lib/Lib/Storage/SMB.php - About 1 hr 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 copyRecursiveMetaDataFiles has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function copyRecursiveMetaDataFiles(string $src, string $srcOwnerUid, string $dst, string $dstOwnerUid) {
            $absSrc = self::pathToAbsDiskPath($srcOwnerUid, $src);
            $absDst = self::pathToAbsDiskPath($dstOwnerUid, $dst);
    
            if (!\is_dir($absSrc)) {
    Severity: Minor
    Found in apps/files_versions/lib/MetaStorage.php - About 1 hr 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 readHostKeys has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function readHostKeys() {
            try {
                $keyPath = $this->hostKeysPath();
                if (\file_exists($keyPath)) {
                    $hosts = [];
    Severity: Minor
    Found in apps/files_external/lib/Lib/Storage/SFTP.php - About 1 hr 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