owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

Function xmlDeserialize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public static function xmlDeserialize(Reader $reader) {
        $newProps = [
            'properties' => [],
            'searchInfo' => null,
        ];
Severity: Minor
Found in apps/dav/lib/Files/Xml/SearchRequest.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 getUsers has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function getUsers() {
        $search = !empty($_GET['search']) ? $_GET['search'] : '';
        $limit = !empty($_GET['limit']) ? $_GET['limit'] : null;
        $offset = !empty($_GET['offset']) ? $_GET['offset'] : null;

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

    private function updateCalendar($cardUri, $cardData, $book, $calendarId, $type) {
        $objectUri = $book['uri'] . '-' . $cardUri . $type['postfix'] . '.ics';
        $calendarData = $this->buildDateFromContact($cardData, $type['field'], $type['symbol']);
        $existing = $this->calDavBackEnd->getCalendarObject($calendarId, $objectUri);
        if ($calendarData === null) {
Severity: Minor
Found in apps/dav/lib/CalDAV/BirthdayService.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 __construct has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct(IRequest $request, $baseUri) {
        $this->request = $request;
        $this->baseUri = $baseUri;
        $logger = OC::$server->getLogger();
        $dispatcher = OC::$server->getEventDispatcher();
Severity: Minor
Found in apps/dav/lib/Server.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 getSearchResultIterator has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function getSearchResultIterator($filesUri, $searchResults, $requestedProps, $maxResults) {
        $paths = [];
        foreach ($searchResults as $searchResult) {
            $paths[$filesUri . $searchResult->path] = $searchResult;
        }
Severity: Minor
Found in apps/dav/lib/Connector/Sabre/FilesSearchReportPlugin.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 handleGetProperties has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

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

    public function createDirectory($name) {
        # the check here is necessary, because createDirectory does not use the methods in files/view.php
        if (Filesystem::isForbiddenFileOrDir($name)) {
            throw new SabreForbidden();
        }
Severity: Minor
Found in apps/dav/lib/Connector/Sabre/Directory.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 handleBeforeMove has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function handleBeforeMove($source, $destination) {
        $sourceNode = $this->server->tree->getNodeForPath($source);

        // get target node for proper path conversion
        $destinationSize = 0;
Severity: Minor
Found in apps/dav/lib/Connector/Sabre/QuotaPlugin.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 isFolderEmpty has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private static function isFolderEmpty($view, $dir) {
        if ($dir === '' || $dir === '.' || $dir === '/') {
            // root folder won't be considered as empty
            return false;
        }
Severity: Minor
Found in apps/files_versions/lib/Storage.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 findRegisteredPanels has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    protected function findRegisteredPanels($type) {
        $panels = [];
        foreach ($this->appManager->getEnabledAppsForUser($this->userSession->getUser()) as $app) {
            if (isset($this->appManager->getAppInfo($app)['settings'])) {
                foreach ($this->appManager->getAppInfo($app)['settings'] as $t => $detected) {
Severity: Minor
Found in lib/private/Settings/SettingsManager.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 searchCommon has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function searchCommon($method, $args) {
        $files = [];
        $rootLength = \strlen($this->path);
        $mount = $this->root->getMount($this->path);
        $storage = $mount->getStorage();
Severity: Minor
Found in lib/private/Files/Node/Folder.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 stream_write has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function stream_write($data) {
        $length = 0;
        // loop over $data to fit it in 6126 sized unencrypted blocks
        while (isset($data[0])) {
            $remainingLength = \strlen($data);
Severity: Minor
Found in lib/private/Files/Stream/Encryption.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 calculateFolderSize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function calculateFolderSize($path, $entry = null) {
        if ($path !== '/' and $path !== '' and $path !== 'files' and $path !== 'files_trashbin' and $path !== 'files_versions') {
            return parent::calculateFolderSize($path, $entry);
        } elseif ($path === '' or $path === '/') {
            // since the size of / isn't used (the size of /files is used instead) there is no use in calculating it
Severity: Minor
Found in lib/private/Files/Cache/HomeCache.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 fopen has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function fopen($path, $mode) {
        $path = $this->normalizePath($path);

        switch ($mode) {
            case 'r':
Severity: Minor
Found in lib/private/Files/ObjectStore/ObjectStoreStorage.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 moveFromCache has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) {
        self::$path_cache->clear();
        if ($sourceCache instanceof Cache) {
            // normalize source and target
            $sourcePath = $this->normalize($sourcePath);
Severity: Minor
Found in lib/private/Files/Cache/Cache.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 getMultiBucketObjectStoreConfig has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function getMultiBucketObjectStoreConfig(IUser $user) {
        $config = $this->config->getSystemValue('objectstore_multibucket');
        if (!\is_array($config)) {
            return null;
        }
Severity: Minor
Found in lib/private/Files/Mount/ObjectHomeMountProvider.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 buildRequestOptions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function buildRequestOptions(array $options): array {
        if (!$this->defaultOptions) {
            $this->setDefaultOptions();
        }

Severity: Minor
Found in lib/private/Http/Client/Client.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 getThumbnail has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function getThumbnail(File $file, $maxX, $maxY, $scalingUp) {
        $stream = $file->fopen('r');
        $content = \stream_get_contents($stream, 2048);
        \fclose($stream);

Severity: Minor
Found in lib/private/Preview/TXT.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 getOldFiles has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getOldFiles(): array {
        $cutOfTime = \time() - 3600;
        $files = [];
        $dh = \opendir($this->tmpBaseDir);
        if ($dh) {
Severity: Minor
Found in lib/private/TempManager.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 10 (exceeds 5 allowed). Consider refactoring.
Open

    public static function splitUserRemote($id) {
        if (\strpos($id, '@') === false) {
            $l = \OC::$server->getL10N('lib');
            $hint = $l->t('Invalid Federated Cloud ID');
            throw new HintException('Invalid Federated Cloud ID', $hint);
Severity: Minor
Found in lib/private/Share/Helper.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