owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

Function checkQuota has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function checkQuota($path, $length = null, $extraSpace = 0) {
        if ($length === null) {
            $length = $this->getLength();
        }
        if ($length !== null) {
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 restoreShares has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function restoreShares(OutputInterface $output) {
        $output->writeln("Restoring shares ...");
        $progress = new ProgressBar($output, \count($this->shares));
        $status = 0;

Severity: Minor
Found in apps/files/lib/Command/TransferOwnership.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 findRegisteredSections has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    protected function findRegisteredSections($type) {
        $sections = [];
        foreach ($this->appManager->getEnabledAppsForUser($this->userSession->getUser()) as $app) {
            if (isset($this->appManager->getAppInfo($app)['settings-sections'])) {
                foreach ($this->appManager->getAppInfo($app)['settings-sections'] as $t => $section) {
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 findUsersInGroup has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function findUsersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
        $group = $this->get($gid);
        if ($group === null) {
            return [];
        }
Severity: Minor
Found in lib/private/Group/Manager.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 displayNamesInGroup has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function displayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0) {
        $group = $this->get($gid);
        if ($group === null) {
            return [];
        }
Severity: Minor
Found in lib/private/Group/Manager.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 emit_file_hooks_pre has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    protected function emit_file_hooks_pre($exists, $path, &$run) {
        $event = new GenericEvent(null);
        if (!$exists) {
            \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_create, [
                Filesystem::signal_param_path => $this->getHookPath($path),
Severity: Minor
Found in lib/private/Files/View.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 getPath has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function getPath($id, $includeShares = true) {
        $id = (int)$id;
        $manager = Filesystem::getMountManager();
        $mounts = $manager->findIn($this->fakeRoot);
        $findResult = $manager->find($this->fakeRoot);
Severity: Minor
Found in lib/private/Files/View.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 createSpecificUser has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function createSpecificUser($username, $connection) {
        try {
            //user already specified in config
            $oldUser = $this->config->getSystemValue('dbuser', false);

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

    public function setupDatabase($username) {
        $e_host = \addslashes($this->dbHost);
        $e_dbname = \addslashes($this->dbName);
        //check if the database user has admin right
        if ($this->dbConnectionString !== null) {
Severity: Minor
Found in lib/private/Setup/OCI.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 load has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function load(array $xmlPath, IUser $user = null) {
        $appManager = $this->getAppManager();
        $allApps = $appManager->getEnabledAppsForUser($user);

        foreach ($allApps as $appId) {
Severity: Minor
Found in lib/private/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 deletePreview has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function deletePreview($keepMax = true) {
        $fileInfo = $this->getFile();
        if ($fileInfo !== null && $fileInfo !== false) {
            if ($keepMax === true) {
                $previewPath = $this->buildCachePath();
Severity: Minor
Found in lib/private/Preview.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 beforeController has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function beforeController($controller, $methodName) {
        // this will set the current navigation entry of the app, use this only
        // for normal HTML requests and not for AJAX requests
        $this->navigationManager->setActiveEntry($this->appName);

Severity: Minor
Found in lib/private/AppFramework/Middleware/Security/SecurityMiddleware.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 executeAudited has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public static function executeAudited($stmt, array $parameters = null) {
        if (\is_string($stmt)) {
            // convert to an array with 'sql'
            if (\stripos($stmt, 'LIMIT') !== false) { //OFFSET requires LIMIT, so we only need to check for LIMIT
                // TODO try to convert LIMIT OFFSET notation to parameters
Severity: Minor
Found in lib/private/legacy/db.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 adjustStreamChunkSize has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function adjustStreamChunkSize($handle) {
        $stream = $handle;
        $metadata = \stream_get_meta_data($stream);
        while ($metadata['stream_type'] === 'user-space') {
            \stream_set_chunk_size($stream, 64 * 1024);
Severity: Minor
Found in lib/private/legacy/image.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 initTemplateEngine has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public static function initTemplateEngine($renderAs) {
        if (self::$initTemplateEngineFirstRun) {
            //apps that started before the template initialization can load their own scripts/styles
            //so to make sure this scripts/styles here are loaded first we use OC_Util::addScript() with $prepend=true
            //meaning the last script/style in this list will be loaded first
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 saveTable has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private static function saveTable($table, $xml) {
        $xml->addChild('name', $table->getName());
        $declaration = $xml->addChild('declaration');
        foreach ($table->getColumns() as $column) {
            self::saveColumn($column, $declaration->addChild('field'));
Severity: Minor
Found in lib/private/DB/MDB2SchemaWriter.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 acquireLock has a Cognitive Complexity of 15 (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");
        }
        $expire = $this->getExpireTime();
Severity: Minor
Found in lib/private/Lock/DBLockingProvider.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 15 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output): int {
        $groupName = $input->getArgument('group');
        $group = $this->groupManager->get($groupName);
        $errorFound = false;
        if (!$group) {
Severity: Minor
Found in core/Command/Group/AddMember.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 15 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output): int {
        $groupName = $input->getArgument('group');
        $group = $this->groupManager->get($groupName);
        $errorFound = false;
        if (!$group) {
Severity: Minor
Found in core/Command/Group/RemoveMember.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 15 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output): int {
        $importFile = $input->getArgument('file');
        if ($importFile !== null) {
            $content = $this->getArrayFromFile($importFile);
        } else {
Severity: Minor
Found in core/Command/Config/Import.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