owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

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

    public function cleanSharesWithInvalidNodes() {
        $types = [
            \OCP\Share::SHARE_TYPE_USER,
            \OCP\Share::SHARE_TYPE_GROUP,
            \OCP\Share::SHARE_TYPE_LINK,
Severity: Minor
Found in lib/private/Share20/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 sharingDisabledForUser has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function sharingDisabledForUser($userId) {
        if ($userId === null) {
            return false;
        }

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

    private function getPossibleThumbnails($allThumbnails) {
        if ($this->keepAspect) {
            $wantedAspectRatio = (float)($this->maxPreviewWidth / $this->maxPreviewHeight);
        } else {
            $wantedAspectRatio = (float)($this->getMaxX() / $this->getMaxY());
Severity: Minor
Found in lib/private/Preview.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 getCachedPreview has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function getCachedPreview($cached) {
        $stream = $this->userView->fopen($cached, 'r');
        $this->preview = null;
        if ($stream) {
            $image = new \OC_Image();
Severity: Minor
Found in lib/private/Preview.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 __construct has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct(ICheck $list) {
        $this->list = $list;

        $this->blackListedClassNames = [];
        foreach ($list->getClasses() as $class => $blackListInfo) {
Severity: Minor
Found in lib/private/App/CodeChecker/NodeVisitor.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 getStatusHeader has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getStatusHeader(
        $status,
        \DateTime $lastModified=null,
        $ETag=null
    ) {
Severity: Minor
Found in lib/private/AppFramework/Http.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 loadCommandsFromInfoXml has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function loadCommandsFromInfoXml($commands) {
        foreach ($commands as $command) {
            try {
                $c = \OC::$server->query($command);
            } catch (QueryException $e) {
Severity: Minor
Found in lib/private/Console/Application.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 getServerProtocol has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getServerProtocol() {
        if ($this->config->getSystemValue('overwriteprotocol') !== ''
            && $this->isOverwriteCondition('protocol')) {
            return $this->config->getSystemValue('overwriteprotocol');
        }
Severity: Minor
Found in lib/private/AppFramework/Http/Request.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 getUserWithAccessToMountPoint has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getUserWithAccessToMountPoint($users, $groups) {
        $result = [];
        if (\in_array('all', $users)) {
            $result = \OCP\User::getUsers();
        } else {
Severity: Minor
Found in lib/private/Encryption/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 parseAppInfo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function parseAppInfo(array $data) {
        // just modify the description if it is available
        // otherwise this will create a $data element with an empty 'description'
        if (isset($data['description'])) {
            if (\is_string($data['description'])) {
Severity: Minor
Found in lib/private/legacy/app.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 load has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function load($imageRef) {
        if (\is_resource($imageRef)) {
            if (\get_resource_type($imageRef) == 'gd') {
                $this->resource = $imageRef;
                return $this->resource;
Severity: Minor
Found in lib/private/legacy/image.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 loadFromBase64 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function loadFromBase64($str) {
        if (!\is_string($str)) {
            return false;
        }
        $data = \base64_decode($str);
Severity: Minor
Found in lib/private/legacy/image.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 getAllFiles has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getAllFiles($dir) {
        $result = [];
        $dirList = [$dir];

        while ($dirList) {
Severity: Minor
Found in lib/private/Encryption/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 findBinaryPath has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function findBinaryPath($program) {
        $memcache = \OC::$server->getMemCacheFactory()->create('findBinaryPath');
        if ($memcache->hasKey($program)) {
            return $memcache->get($program);
        }
Severity: Minor
Found in lib/private/legacy/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 data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function data() {
        if (!$this->valid()) {
            return null;
        }
        \ob_start();
Severity: Minor
Found in lib/private/legacy/image.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 loadExifData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function loadExifData($file) {
        if (!\is_callable('exif_read_data')) {
            $this->logger->debug('OC_Image->loadExifData() Exif module not enabled.', ['app' => 'core']);
            return;
        }
Severity: Minor
Found in lib/private/legacy/image.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 verifySignature has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function verifySignature(array $params, $urlCredential, $algo, $urlSignature): bool {
        $trustedList = $this->config->getSystemValue('trusted_domains', []);
        $signingKey = $this->config->getUserValue($urlCredential, 'core', 'signing-key');
        // in case the signing key is not initialized, no signature can ever be verified
        if ($signingKey === '') {
Severity: Minor
Found in lib/private/Security/SignedUrl/Verifier.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 loadTable has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function loadTable($schema, $xml) {
        $table = null;
        foreach ($xml->children() as $child) {
            /**
             * @var \SimpleXMLElement $child
Severity: Minor
Found in lib/private/DB/MDB2SchemaReader.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 getAccountModules has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getAccountModules(IUser $user) {
        $loaded = $this->loader->load(['account-modules'], $user);

        // load order from appconfig
        $rawOrder = $this->config->getAppValue('core', 'account-module-order', '[]');
Severity: Minor
Found in lib/private/Authentication/AccountModule/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 computeHash has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function computeHash(string $algo, string $url, $signingKey) {
        if (\preg_match('/^(.*)\/(.*)-(.*)$/', $algo, $output)) {
            if ($output[1] !== 'PBKDF2') {
                return false;
            }
Severity: Minor
Found in lib/private/Security/SignedUrl/Verifier.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