owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

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

    private static function transformDBResults(&$row) {
        if (isset($row['id'])) {
            $row['id'] = (int) $row['id'];
        }
        if (isset($row['share_type'])) {
Severity: Minor
Found in lib/private/Share/Share.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 repairMimetypes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function repairMimetypes($wrongMimetypes) {
        foreach ($wrongMimetypes as $wrong => $correct) {
            // do we need to remove a wrong mimetype?
            $result = \OC_DB::executeAudited(self::getIdStmt(), [$wrong]);
            $wrongId = $result->fetchOne();
Severity: Minor
Found in lib/private/Repair/RepairMimeTypes.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 run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function run(IOutput $out) {
        if (!$this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
            return;
        }

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

    private function resolveGroupShares($shares, $userId) {
        $qb = $this->dbConn->getQueryBuilder();

        list($chunkedShareIds, $shareIdToShareMap) = $this->chunkSharesToMaps($shares);
        foreach ($chunkedShareIds as $shareIdsChunk) {
Severity: Minor
Found in lib/private/Share20/DefaultShareProvider.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 getRequestUri has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function getRequestUri() {
        $uri = $this->server['REQUEST_URI'] ?? '';
        // remove too many leading slashes - can be caused by reverse proxy configuration
        if (\strpos($uri, '/') === 0) {
            $uri = '/' . \ltrim($uri, '/');
Severity: Minor
Found in lib/private/AppFramework/Http/Request.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 copyr has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public static function copyr($src, $dest) {
        if (\is_dir($src)) {
            if (!\is_dir($dest)) {
                \mkdir($dest);
            }
Severity: Minor
Found in lib/private/legacy/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

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

    public static function buildNotExistingFileNameForView($path, $filename, \OC\Files\View $view) {
        if ($path === '/') {
            $path = '';
        }
        if ($pos = \strrpos($filename, '.')) {
Severity: Minor
Found in lib/private/legacy/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

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

    public function isSystemWideMountPoint($path, $uid) {
        if (\OCP\App::isEnabled("files_external")) {
            $mounts = \OC\Files\External\LegacyUtil::getSystemMountPoints();
            foreach ($mounts as $mount) {
                if (\strpos($path, '/files/' . $mount['mountpoint']) === 0) {
Severity: Minor
Found in lib/private/Encryption/Util.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 canExecute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public static function canExecute($name, $path = false) {
        // path defaults to PATH from environment if not set
        if ($path === false) {
            $path = \getenv("PATH");
        }
Severity: Minor
Found in lib/private/legacy/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

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

    private function analyzeCommands(array $dependencies) {
        $missing = [];
        if (!isset($dependencies['command'])) {
            return $missing;
        }
Severity: Minor
Found in lib/private/App/DependencyAnalyzer.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 fetchPage has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function fetchPage($additionalParams = null) {
        $data = parent::fetchPage($additionalParams);

        if ($this->renderAs) {
            $page = new TemplateLayout($this->renderAs, $this->app);
Severity: Minor
Found in lib/private/legacy/template.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 listCertificates has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function listCertificates() {
        if (!$this->config->getSystemValue('installed', false)) {
            return [];
        }

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

    public function callForUsers($callback, $search, $onlySeen, $limit = null, $offset = null) {
        $qb = $this->db->getQueryBuilder();
        $qb->select(['*'])
            ->from($this->getTableName());

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

    public function changeLock($path, $targetType) {
        if ($targetType === self::LOCK_SHARED) {
            if (!$this->hasAcquiredLock($path, self::LOCK_EXCLUSIVE)) {
                // trying to change a lock that we haven't acquired -> throw exception
                \OCP\Util::writeLog('core', "trying lock change to type $targetType for $path, but the lock hasn't been acquired before!!", \OCP\Util::WARN);
Severity: Minor
Found in lib/private/Lock/MemcacheLockingProvider.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 syncState has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function syncState(Account $a) {
        $uid = $a->getUserId();
        list($hasKey, $value) = $this->readUserConfig($uid, 'core', 'enabled');
        if ($hasKey) {
            if ($value === 'true') {
Severity: Minor
Found in lib/private/User/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 getRoutingFiles has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function getRoutingFiles() {
        if (!isset($this->routingFiles)) {
            $this->routingFiles = [];
            foreach (\OC_App::getEnabledApps() as $app) {
                $appPath = \OC_App::getAppPath($app);
Severity: Minor
Found in lib/private/Route/Router.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 getAppsRepairSteps has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function getAppsRepairSteps(OutputInterface $output) {
        $apps = $this->appManager->getEnabledAppsForUser();
        $steps = [];
        foreach ($apps as $app) {
            try {
Severity: Minor
Found in core/Command/Maintenance/Repair.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 getAllLanguages has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function getAllLanguages($path) {
        $result = [];
        foreach (new DirectoryIterator("$path/l10n") as $fileInfo) {
            if ($fileInfo->isDot()) {
                continue;
Severity: Minor
Found in core/Command/L10n/CreateJs.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 execute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output): int {
        $configNames = $input->getArgument('name');
        $configName = $configNames[0];

        if (\sizeof($configNames) > 1) {
Severity: Minor
Found in core/Command/Config/System/DeleteConfig.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 handleRepairFeedback has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function handleRepairFeedback($event) {
        if (!$event instanceof GenericEvent) {
            return;
        }

Severity: Minor
Found in core/ajax/update.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