owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

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

    private function loadSabreCollectionsFromInfoXml($collections) {
        foreach ($collections as $collection) {
            try {
                $this->collections[] = $this->container->query($collection);
            } catch (QueryException $e) {
Severity: Minor
Found in apps/dav/lib/AppInfo/PluginManager.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 releaseLock has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function releaseLock(RequestInterface $request) {
        if ($request->getMethod() !== 'PUT' || \OC_FileChunking::isWebdavChunk()) {
            return;
        }

Severity: Minor
Found in apps/dav/lib/Connector/Sabre/LockPlugin.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 getTags has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function getTags($fileId) {
        if (isset($this->cachedTags[$fileId])) {
            return $this->cachedTags[$fileId];
        } else {
            $tags = $this->getTagger()->getTagsForObjects([$fileId]);
Severity: Minor
Found in apps/dav/lib/Connector/Sabre/TagsPlugin.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 checkViewOnly has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function checkViewOnly(
        RequestInterface $request
    ) {
        $path = $request->getPath();

Severity: Minor
Found in apps/dav/lib/DAV/ViewOnlyPlugin.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 findNodesByFileIds has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function findNodesByFileIds($rootNode, $fileIds) {
        $folder = $this->userFolder;
        if (\trim($rootNode->getPath(), '/') !== '') {
            $folder = $folder->get($rootNode->getPath());
        }
Severity: Minor
Found in apps/dav/lib/Connector/Sabre/FilesReportPlugin.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 loadSabrePluginsFromInfoXml has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function loadSabrePluginsFromInfoXml($plugins) {
        foreach ($plugins as $plugin) {
            try {
                $this->plugins[] = $this->container->query($plugin);
            } catch (QueryException $e) {
Severity: Minor
Found in apps/dav/lib/AppInfo/PluginManager.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 processFilterRules has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function processFilterRules($filterRules) {
        $resultFileIds = null;
        $systemTagIds = $filterRules['systemtag'];
        $favoriteFilter = $filterRules['favorite'];

Severity: Minor
Found in apps/dav/lib/Connector/Sabre/FilesReportPlugin.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 getNodeForPath has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getNodeForPath($path) {
        // FIXME: remove this check when we are sure that other
        // non-files endpoints work correctly

        // querying "files" directly or anything outside of it
Severity: Minor
Found in apps/dav/lib/Tree.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 rmdir has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function rmdir($path) {
        $this->log('enter: '.__FUNCTION__."($path)");

        if ($this->isRootDir($path)) {
            $this->log("refusing to delete \"$path\"");
Severity: Minor
Found in apps/files_external/lib/Lib/Storage/SMB.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 getHumanReadableTimestamp has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function getHumanReadableTimestamp($timestamp) {
        $diff = \time() - $timestamp;

        if ($diff < 60) { // first minute
            return  $diff . " seconds ago";
Severity: Minor
Found in apps/files_versions/lib/Storage.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 leave has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function leave($function, $result) {
        if (!$this->logActive) {
            //don't bother building log strings
            return $result;
        } elseif ($result === true) {
Severity: Minor
Found in apps/files_external/lib/Lib/Storage/SMB.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 findOneQuery has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function findOneQuery($sql, array $params=[], $limit=null, $offset=null) {
        if ($sql instanceof IQueryBuilder) {
            $stmt = $sql->execute();
        } else {
            $stmt = $this->execute($sql, $params, $limit, $offset);
Severity: Minor
Found in lib/public/AppFramework/Db/Mapper.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 updateFileTags has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function updateFileTags($path, $tags = null) {
        $result = [];
        // if tags specified or empty array, update tags
        if ($tags !== null) {
            try {
Severity: Minor
Found in apps/files/lib/Controller/ApiController.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 checkSingleUserMode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function checkSingleUserMode($lockIfNoUserLoggedIn = false) {
        if (!\OC::$server->getSystemConfig()->getValue('singleuser', false)) {
            return;
        }
        $user = OC_User::getUserSession()->getUser();
Severity: Minor
Found in lib/kernel.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 check has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function check() {
        // Look up the cache - it is invalidated all 30 minutes
        if (((int)$this->config->getAppValue('core', 'lastupdatedat') + 1800) > \time()) {
            return \json_decode($this->config->getAppValue('core', 'lastupdateResult'), true);
        }
Severity: Minor
Found in lib/private/Updater/VersionCheck.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 setter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function setter($name, $args) {
        // setters should only work for existing attributes
        if (\property_exists($this, $name)) {
            if ($args[0] === $this->$name) {
                return;
Severity: Minor
Found in lib/public/AppFramework/Db/Entity.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 getColors has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function getColors($raw) {
        $extra = \chr(0); // used to complement an argument to word or double word
        $colors = [];
        if (\in_array($this->header['bits'], [32, 24])) {
            $colors = @\unpack('V', $raw . $extra);
Severity: Minor
Found in lib/private/Image/BmpToResource.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(
        $logger = null,
        SystemConfig $config = null,
        $normalizer = null,
        EventDispatcherInterface $eventDispatcher = null
Severity: Minor
Found in lib/private/Log.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 getObjectIdsForTags has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getObjectIdsForTags($tagIds, $objectType, $limit = 0, $offset = '') {
        if (!\is_array($tagIds)) {
            $tagIds = [$tagIds];
        }

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

    public function touch($mtime = null) {
        if ($this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE)) {
            $this->sendHooks(['preTouch']);
            $this->view->touch($this->path, $mtime);
            $this->sendHooks(['postTouch']);
Severity: Minor
Found in lib/private/Files/Node/Node.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