owncloud/core

View on GitHub

Showing 3,236 of 4,502 total issues

Function pre_renameOrCopy_hook has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function pre_renameOrCopy_hook($params) {
        if (\OCP\App::isEnabled('files_versions')) {
            // if we rename a movable mount point, then the versions don't have
            // to be renamed
            $absOldPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files' . $params['oldpath']);
Severity: Minor
Found in apps/files_versions/lib/Hooks.php - About 25 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 handleAuthHeaders has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected static function handleAuthHeaders() {
        //copy http auth headers for apache+php-fcgid work around
        if (isset($_SERVER['HTTP_XAUTHORIZATION']) && !isset($_SERVER['HTTP_AUTHORIZATION'])) {
            $_SERVER['HTTP_AUTHORIZATION'] = $_SERVER['HTTP_XAUTHORIZATION'];
        }
Severity: Minor
Found in lib/kernel.php - About 25 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 buildOCSResponse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function buildOCSResponse($format, $data) {
        if ($data instanceof Result) {
            $headers = $data->getHeaders();
            $d = $data->getData();
            $data = $data->getMeta();
Severity: Minor
Found in lib/public/AppFramework/OCSController.php - About 25 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 checkInstalled has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function checkInstalled() {
        if (\defined('OC_CONSOLE')) {
            return;
        }
        // Redirect to installer if not installed
Severity: Minor
Found in lib/kernel.php - About 25 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 loadAppClassPaths has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function loadAppClassPaths() {
        foreach (OC_App::getEnabledApps() as $app) {
            $appPath = OC_App::getAppPath($app);
            if ($appPath === false) {
                continue;
Severity: Minor
Found in lib/kernel.php - About 25 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 loadSection has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function loadSection($type, $sectionID) {
        // Load built in sections
        foreach ($this->getBuiltInSections($type) as $section) {
            if ($section->getID() === $sectionID) {
                return $section;
Severity: Minor
Found in lib/private/Settings/SettingsManager.php - About 25 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 getTagIdsForObjects has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getTagIdsForObjects($objIds, $objectType) {
        if (!\is_array($objIds)) {
            $objIds = [$objIds];
        } elseif (empty($objIds)) {
            return [];
Severity: Minor
Found in lib/private/SystemTag/SystemTagObjectMapper.php - About 25 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 shouldEmitHooks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function shouldEmitHooks($path = '') {
        if ($path && Cache\Scanner::isPartialFile($path)) {
            return false;
        }
        if (!Filesystem::$loaded) {
Severity: Minor
Found in lib/private/Files/View.php - About 25 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 getStream has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getStream($path, $mode) {
        if (\strrpos($path, '.') !== false) {
            $ext = \substr($path, \strrpos($path, '.'));
        } else {
            $ext = '';
Severity: Minor
Found in lib/private/Archive/TAR.php - About 25 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 getFolder has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getFolder($path) {
        $files=$this->getFiles();
        $folderContent= [];
        $pathLength=\strlen($path);
        foreach ($files as $file) {
Severity: Minor
Found in lib/private/Archive/ZIP.php - About 25 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 cleanPath has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function cleanPath($path) {
        if (\strlen($path) == 0 or $path[0] != '/') {
            $path = '/' . $path;
        }

Severity: Minor
Found in lib/private/Files/Storage/Common.php - About 25 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 delete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function delete() {
        // Prevent users from deleting group admin
        if ($this->getGID() === 'admin') {
            return false;
        }
Severity: Minor
Found in lib/private/Group/Group.php - About 25 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 changeLock has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function changeLock($path, $type, $lockMountPoint = false) {
        $path = Filesystem::normalizePath($path);
        $absolutePath = $this->getAbsolutePath($path);
        $absolutePath = Filesystem::normalizePath($absolutePath);
        if (!$this->shouldLockFile($absolutePath)) {
Severity: Minor
Found in lib/private/Files/View.php - About 25 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 count has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function count($search = '') {
        $users = false;
        foreach ($this->backends as $backend) {
            if ($backend->implementsActions(\OC\Group\Backend::COUNT_USERS)) {
                if ($users === false) {
Severity: Minor
Found in lib/private/Group/Group.php - About 25 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 startHashingContexts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function startHashingContexts($algos = null) {
        if ($algos === null) {
            foreach ($this->hashingContexts as $key => $value) {
                $this->hashingContexts[$key] = \hash_init($key);
            }
Severity: Minor
Found in lib/private/Files/Stream/Checksum.php - About 25 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 getTagsByIds has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getTagsByIds($tagIds) {
        if (!\is_array($tagIds)) {
            $tagIds = [$tagIds];
        }

Severity: Minor
Found in lib/private/SystemTag/SystemTagManager.php - About 25 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 lockPath has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function lockPath($path, $type, $lockMountPoint = false) {
        $absolutePath = $this->getAbsolutePath($path);
        $absolutePath = Filesystem::normalizePath($absolutePath);
        if (!$this->shouldLockFile($absolutePath)) {
            return false;
Severity: Minor
Found in lib/private/Files/View.php - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function touch($path, $mtime = null) {
        // sets the modification time of the file to the given value.
        // If mtime is nil the current time is set.
        // note that the access time of the file always changes to the current time.
        if ($this->file_exists($path) and !$this->isUpdatable($path)) {
Severity: Minor
Found in lib/private/Files/Storage/Local.php - About 25 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 file_get_contents has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function file_get_contents($path) {
        if ($this->encryptionManager->isEnabled() !== false) {
            $encryptionModule = $this->getEncryptionModule($path);

            if ($encryptionModule) {
Severity: Minor
Found in lib/private/Files/Storage/Wrapper/Encryption.php - About 25 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 moveFromStorage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) {
        if ($sourceStorage === $this) {
            return $this->rename($sourceInternalPath, $targetInternalPath);
        }

Severity: Minor
Found in lib/private/Files/Storage/Common.php - About 25 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