owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

Function getStorageId has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getStorageId() {
        if (!$this->storageId) {
            if (\method_exists($this->mount, 'getStorageNumericId')) {
                /* @phan-suppress-next-line PhanUndeclaredMethod */
                $this->storageId = $this->mount->getStorageNumericId();
Severity: Minor
Found in lib/private/Files/Config/LazyStorageMountInfo.php - About 35 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 moveFromStorage has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function moveFromStorage(Storage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = true) {
        if ($sourceStorage === $this) {
            return $this->rename($sourceInternalPath, $targetInternalPath);
        }

Severity: Minor
Found in lib/private/Files/Storage/Wrapper/Encryption.php - About 35 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 validateStorageDefinition has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function validateStorageDefinition(IStorageConfig $storage) {
        foreach ($this->getParameters() as $name => $parameter) {
            $value = $storage->getBackendOption($name);
            if ($value !== null || !$parameter->isOptional()) {
                if (!$parameter->validateValue($value)) {
Severity: Minor
Found in lib/private/Files/External/FrontendDefinitionTrait.php - About 35 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 isUpgradePossible has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function isUpgradePossible($oldVersion, $newVersion, $allowedPreviousVersions) {
        // TODO: write tests for this, since i just wrapped it to get started with migrations and this might fail in some cases
        foreach ($allowedPreviousVersions as $allowedPreviousVersion) {
            $allowedUpgrade =  (\version_compare($allowedPreviousVersion, $oldVersion, '<=')
                && (\version_compare($oldVersion, $newVersion, '<=') || $this->config->getSystemValue('debug', false)));
Severity: Minor
Found in lib/private/Updater.php - About 35 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 newClient has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function newClient($settings) {
        if (!isset($settings['proxy'])) {
            $proxy = $this->getProxyUri();
            if ($proxy !== '') {
                $settings['proxy'] = $proxy;
Severity: Minor
Found in lib/private/Http/Client/WebDavClientService.php - About 35 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 rename has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function rename($from, $to) {
        $from = \trim($from);
        $to = \trim($to);

        if ($to === '' || $from === '') {
Severity: Minor
Found in lib/private/Tags.php - About 35 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 doUpgrade has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function doUpgrade($currentVersion, $installedVersion) {
        // Stop update if the update is over several major versions
        $allowedPreviousVersions = $this->getAllowedPreviousVersions();
        if (!self::isUpgradePossible($installedVersion, $currentVersion, $allowedPreviousVersions)) {
            throw new \Exception('Updates between multiple major versions and downgrades are unsupported.');
Severity: Minor
Found in lib/private/Updater.php - About 35 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 getThumbnail has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getThumbnail(File $file, $maxX, $maxY, $scalingUp) {
        // TODO: use proc_open() and stream the source file ?

        $useFileDirectly = (!$file->isEncrypted() && !$file->isMounted());
        if ($useFileDirectly) {
Severity: Minor
Found in lib/private/Preview/Movie.php - About 35 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 createDBUser has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function createDBUser($connection) {
        $e_name = \pg_escape_string($this->dbUser);
        $e_password = \pg_escape_string($this->dbPassword);
        $query = "select * from pg_roles where rolname='$e_name';";
        $result = \pg_query($connection, $query);
Severity: Minor
Found in lib/private/Setup/PostgreSQL.php - About 35 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 loadConfigValues has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function loadConfigValues() {
        if ($this->configLoaded) {
            return;
        }

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

    public function deleteAllForUser($user) {
        $userId = $user->getUID();
        $result = false;
        //Get all valid storages
        $mounts = $this->getStorages();
Severity: Minor
Found in lib/private/Files/External/Service/GlobalStoragesService.php - About 35 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 jsonSerialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function jsonSerialize() {
        $result = [];
        if ($this->id !== null) {
            $result['id'] = $this->id;
        }
Severity: Minor
Found in lib/private/Files/External/StorageConfig.php - About 35 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 runInstanceVerification has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function runInstanceVerification() {
        $this->cleanResults();
        $this->verifyCoreSignature();

        // FIXME: appManager === null means ownCloud is not installed. We check all apps in this case
Severity: Minor
Found in lib/private/IntegrityCheck/Checker.php - About 35 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 queryPreviewsToDelete has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function queryPreviewsToDelete(int $startFileId = 0, int $chunkSize = 1000): array {
        $dbPlatform = $this->connection->getDatabasePlatform();
        $isOracle = ($dbPlatform instanceof OraclePlatform);
        $isOldMysql = ($dbPlatform instanceof MySqlPlatform && !($dbPlatform instanceof MySQL80Platform || $dbPlatform instanceof MariaDb1027Platform));

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

    public static function calculateExpireDate($defaultExpireSettings, $creationTime, $userExpireDate = null) {
        $expires = false;
        $defaultExpires = null;

        if (!empty($defaultExpireSettings['defaultExpireDateSet'])) {
Severity: Minor
Found in lib/private/Share/Helper.php - About 35 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 getCollectionItemTypes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function getCollectionItemTypes($itemType) {
        $collectionTypes = [$itemType];
        foreach (self::$backendTypes as $type => $backend) {
            if (\in_array($backend['collectionOf'], $collectionTypes)) {
                $collectionTypes[] = $type;
Severity: Minor
Found in lib/private/Share/Share.php - About 35 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 unshare has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function unshare($itemType, $itemSource, $shareType, $shareWith, $owner = null) {
        // check if it is a valid itemType
        self::getBackend($itemType);

        $items = self::getItemSharedWithUser($itemType, $itemSource, $shareWith, $owner, $shareType);
Severity: Minor
Found in lib/private/Share/Share.php - About 35 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 resolveReShare has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function resolveReShare($linkItem) {
        if (isset($linkItem['parent'])) {
            $parent = $linkItem['parent'];
            while (isset($parent)) {
                $query = \OC_DB::prepare('SELECT * FROM `*PREFIX*share` WHERE `id` = ?', 1);
Severity: Minor
Found in lib/private/Share/Share.php - About 35 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 getUsersItemShared has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getUsersItemShared($itemType, $itemSource, $uidOwner, $includeCollections = false, $checkExpireDate = true) {
        $users = [];
        $items = self::getItems($itemType, $itemSource, null, null, $uidOwner, self::FORMAT_NONE, null, -1, $includeCollections, false, $checkExpireDate);
        if ($items) {
            foreach ($items as $item) {
Severity: Minor
Found in lib/private/Share/Share.php - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function changeSchema(Schema $schema, array $options) {
        $prefix = $options['tablePrefix'];
        if ($schema->hasTable("{$prefix}jobs")) {
            $jobsTable = $schema->getTable("{$prefix}jobs");

Severity: Minor
Found in lib/private/Repair/Apps.php - About 35 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