owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

Function touch has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function touch($path, $mtime = null) {
        if ($mtime === null) {
            $mtime = \time();
        }

Severity: Minor
Found in lib/private/Files/ObjectStore/ObjectStoreStorage.php - About 55 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 fopen has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function fopen($path, $mode) {
        $source = $this->storage->fopen($path, $mode);

        $used = \OCP\Files\FileInfo::SPACE_NOT_COMPUTED;
        $free = $this->free_space('');
Severity: Minor
Found in lib/private/Files/Storage/Wrapper/Quota.php - About 55 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 getChildrenWithFilter has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function getChildrenWithFilter($fileId, $mimetypeFilter = null) {
        if ($fileId > -1) {
            $qb = $this->connection->getQueryBuilder();
            $qb->select(
                'fileid',
Severity: Minor
Found in lib/private/Files/Cache/Cache.php - About 55 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 fixUnencryptedSize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function fixUnencryptedSize($path, $size, $unencryptedSize) {
        $headerSize = $this->getHeaderSize($path);
        $header = $this->getHeader($path);
        $encryptionModule = $this->getEncryptionModule($path);

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

    public function opendir($path) {
        $this->init();
        $path = $this->cleanPath($path);
        try {
            // client propfind is in \OC\HTTP\Client
Severity: Minor
Found in lib/private/Files/Storage/DAV.php - About 55 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 free_space has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function free_space($path) {
        if ($this->quota < 0) {
            return $this->storage->free_space($path);
        } else {
            $used = $this->getSize($this->sizeRoot);
Severity: Minor
Found in lib/private/Files/Storage/Wrapper/Quota.php - About 55 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 detect has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function detect($path) {
        $this->loadMappings();

        if (@\is_dir($path)) {
            // directories are easy
Severity: Minor
Found in lib/private/Files/Type/Detection.php - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct($params) {
        if (isset($params['objectstore']) && $params['objectstore'] instanceof IObjectStore) {
            $this->objectStore = $params['objectstore'];
        } else {
            throw new \Exception('missing IObjectStore instance');
Severity: Minor
Found in lib/private/Files/ObjectStore/ObjectStoreStorage.php - About 55 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 filesize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function filesize($path) {
        $fullPath = $this->getFullPath($path);

        /** @var CacheEntry $info */
        $info = $this->getCache()->get($path);
Severity: Minor
Found in lib/private/Files/Storage/Wrapper/Encryption.php - About 55 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 getPathById has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function getPathById($id) {
        if (!isset(self::$path_cache[(int)$id])) {
            $sql = 'SELECT `storage`, `path` FROM `*PREFIX*filecache` WHERE `fileid` = ?';
            $result = $this->connection->executeQuery($sql, [$id]);
            if ($row = $result->fetch()) {
Severity: Minor
Found in lib/private/Files/Cache/Cache.php - About 55 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 createStorage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function createStorage() {
        if ($this->invalidStorage) {
            return null;
        }

Severity: Minor
Found in lib/private/Files/Mount/MountPoint.php - About 55 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 getQueryForFilter has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function getQueryForFilter($filter) {
        if (!$this->isFilterValid($filter)) {
            return [null, null];
        }

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

    public static function setUserVars($user, $input) {
        if (\is_array($input)) {
            foreach ($input as $key => $value) {
                if (\is_string($value)) {
                    $input[$key] = \str_replace('$user', $user, $value);
Severity: Minor
Found in lib/private/Files/External/LegacyUtil.php - About 55 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 setUserVars has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function setUserVars($user, $input) {
        if (\is_array($input)) {
            foreach ($input as $key => $value) {
                if (\is_string($value)) {
                    $input[$key] = \str_replace('$user', $user, $value);
Severity: Minor
Found in lib/private/Files/External/ConfigAdapter.php - About 55 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 getTagsForObjects has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function getTagsForObjects(array $objIds) {
        $entries = [];

        try {
            $conn = \OC::$server->getDatabaseConnection();
Severity: Minor
Found in lib/private/Tags.php - About 55 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 setDefaultOptions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function setDefaultOptions() {
        $options = [];
        // Either use user bundle or the system bundle if nothing is specified
        if ($this->certificateManager->listCertificates() !== []) {
            $options[RequestOptions::VERIFY] = $this->certificateManager->getAbsoluteBundlePath();
Severity: Minor
Found in lib/private/Http/Client/Client.php - About 55 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 expireItem has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected static function expireItem(array $item) {
        $result = false;

        // only use default expiration date for link shares
        if ((int) $item['share_type'] === self::SHARE_TYPE_LINK) {
Severity: Minor
Found in lib/private/Share/Share.php - About 55 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 sort has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function sort($a, $b) {
        if (!isset($a[$this->key]) || !isset($b[$this->key])) {
            if ($this->log !== null) {
                $this->log->error('Sharing dialogue: cannot sort due to ' .
                                  'missing array key', ['app' => 'core']);
Severity: Minor
Found in lib/private/Share/SearchResultSorter.php - About 55 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 getNode has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function getNode() {
        if ($this->node === null) {
            if ($this->shareOwner === null || $this->fileId === null) {
                throw new NotFoundException();
            }
Severity: Minor
Found in lib/private/Share20/Share.php - About 55 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 fixUnmergedShares has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function fixUnmergedShares(IOutput $out, IUser $user) {
        $groups = $this->groupManager->getUserGroupIds($user);
        if (empty($groups)) {
            // user is in no groups, so can't have received group shares
            return;
Severity: Minor
Found in lib/private/Repair/RepairUnmergedShares.php - About 55 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