owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

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

    public function isTwoFactorEnforcedForUser(IUser $user) {
        if ($this->config->getAppValue('core', 'enforce_2fa', 'no') !== 'yes') {
            return false;
        }

Severity: Minor
Found in lib/private/Authentication/TwoFactorAuth/Manager.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 checkPreSignedUrl has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function checkPreSignedUrl(): bool {
        $request = \Sabre\HTTP\Sapi::createFromServerArray($_SERVER);
        $verifier = new Verifier($request, \OC::$server->getConfig());
        if ($verifier->isSignedRequest()) {
            if (!$verifier->signedRequestIsValid()) {
Severity: Minor
Found in lib/private/legacy/util.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 getMigrationsToExecute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function getMigrationsToExecute($to) {
        $knownMigrations = $this->getMigratedVersions();
        $availableMigrations = $this->getAvailableVersions();

        $toBeExecuted = [];
Severity: Minor
Found in lib/private/DB/MigrationService.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 isLocked has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function isLocked($path, $type) {
        if ($this->hasAcquiredLock($path, $type)) {
            return true;
        }
        $query = $this->connection->prepare('SELECT `lock` from `*PREFIX*file_locks` WHERE `key` = ?');
Severity: Minor
Found in lib/private/Lock/DBLockingProvider.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 getDiff has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getDiff(Schema $targetSchema, \Doctrine\DBAL\Connection $connection) {
        $this->registerAdditionalMappings($connection);

        // with sqlite autoincrement columns is of type integer
        foreach ($targetSchema->getTables() as $table) {
Severity: Minor
Found in lib/private/DB/SQLiteMigrator.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 processLines has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function processLines(array $params, array &$data) {
        static $lastProcessedChar = null;

        if (!isset($data['linesNumber'])) {
            $data = [
Severity: Minor
Found in lib/private/Utf8Analyzer.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 isTwoFactorEnforced has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function isTwoFactorEnforced($username) {
        $handled = false;
        // the $handled var will be sent as reference so the listeners can use it as a flag
        // in order to know if the event has been processed already or not.
        Util::emitHook(
Severity: Minor
Found in lib/private/User/Session.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 listJobs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function listJobs(\Closure $callback) {
        $query = $this->connection->getQueryBuilder();
        $query->select('*')
            ->from('jobs');
        $result = $query->execute();
Severity: Minor
Found in lib/private/BackgroundJob/JobList.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 prepareUserLogin has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function prepareUserLogin($firstTimeLogin = false) {
        // TODO: mock/inject/use non-static
        // Refresh the token
        \OC::$server->getCsrfTokenManager()->refreshToken();
        //we need to pass the user name, which may differ from login name
Severity: Minor
Found in lib/private/User/Session.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 naturalSortChunkify has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function naturalSortChunkify($t) {
        // Adapted and ported to PHP from
        // http://my.opera.com/GreyWyvern/blog/show.dml/1671288
        if (isset($this->cache[$t])) {
            return $this->cache[$t];
Severity: Minor
Found in lib/private/NaturalSort.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 getNormalizedLanguages has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getNormalizedLanguages(IFactory $langFactory, $activeLangCode) {
        $userLang = null;
        $commonLanguages = [];
        $languages = [];

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

    public function validateSession() {
        $sessionUser = $this->getUser();
        if (!$sessionUser) {
            return;
        }
Severity: Minor
Found in lib/private/User/Session.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 syncQuota has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function syncQuota(Account $a, UserInterface $backend) {
        $uid = $a->getUserId();
        $quota = null;
        if ($backend instanceof IProvidesQuotaBackend) {
            $quota = $backend->getQuota($uid);
Severity: Minor
Found in lib/private/User/SyncService.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 markRelease has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function markRelease($path, $type) {
        if ($type === self::LOCK_SHARED) {
            if (isset($this->acquiredLocks['shared'][$path]) and $this->acquiredLocks['shared'][$path] > 0) {
                $this->acquiredLocks['shared'][$path]--;
                if ($this->acquiredLocks['shared'][$path] === 0) {
Severity: Minor
Found in lib/private/Lock/AbstractLockingProvider.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 compare has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function compare($a, $b) {
        // Needed because PHP doesn't sort correctly when numbers are enclosed in
        // parenthesis, even with NUMERIC_COLLATION enabled.
        // For example it gave ["test (2).txt", "test.txt"]
        // instead of ["test.txt", "test (2).txt"]
Severity: Minor
Found in lib/private/NaturalSort.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 acquireLock has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function acquireLock($path, $type) {
        if (\strlen($path) > 64) { // max length in file_locks
            throw new \InvalidArgumentException('Lock key length too long');
        }
        if ($type === self::LOCK_SHARED) {
Severity: Minor
Found in lib/private/Lock/MemcacheLockingProvider.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 getAuthModules has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getAuthModules($includeBuiltIn) {
        if ($includeBuiltIn) {
            yield new TokenAuthModule($this->session, $this->tokenProvider, $this->manager);
        }

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

    public function sendCookie(IConfig $config): void {
        if ($this->request->getCookie(self::COOKIE_NAME) !== null) {
            // just set the passphrase, don't send it to the browser.
            $this->passphrase = $this->request->getCookie(self::COOKIE_NAME);
            if ($this->request->getHeader('X-Requested-With') !== 'XMLHttpRequest') {
Severity: Minor
Found in lib/private/Session/CryptoWrapper.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 loadUser has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function loadUser($uid) {
        // if not in cache (false is a valid value)
        if (!isset($this->cache[$uid]) && $this->cache[$uid] !== false) {
            $query = \OC_DB::prepare('SELECT `uid`, `displayname` FROM `*PREFIX*users` WHERE LOWER(`uid`) = LOWER(?)');
            $result = $query->execute([$uid]);
Severity: Minor
Found in lib/private/User/Database.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 checkIfAccountReappeared has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function checkIfAccountReappeared(Account $a, array &$removed, array &$reappeared, UserInterface $backend, $backendClass) {
        if ($a->getBackend() === $backendClass) {
            // Does the backend have this user still
            if ($backend->userExists($a->getUserId())) {
                // Is the user not enabled currently?
Severity: Minor
Found in lib/private/User/SyncService.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