owncloud/core

View on GitHub

Showing 4,502 of 4,502 total issues

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

    public function mkdir($path) {
        if (!$this->is_dir($path)) {
            $parentFolder = $this->getDriveFile(\dirname($path));
            if ($parentFolder) {
                $folder = new DriveFile();
Severity: Minor
Found in apps/files_external/lib/Lib/Storage/Google.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 setDriveFileHelper has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function setDriveFileHelper($path, $file) {
        $path = \trim($path, '/');
        $this->driveFiles[$path] = $file;
        if ($file === false) {
            // Remove all children
Severity: Minor
Found in apps/files_external/lib/Lib/Storage/Google.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 getConnection has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getConnection() {
        if ($this->client !== null) {
            return $this->client;
        }

Severity: Minor
Found in apps/files_external/lib/Lib/Storage/SFTP.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 postStore has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function postStore(string $filename) {
        if (self::metaEnabled()) {
            // we don't support versioned directories
            if (Filesystem::is_dir($filename) || !Filesystem::file_exists($filename)) {
                return false;
Severity: Minor
Found in apps/files_versions/lib/Storage.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 analyse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function analyse(OutputInterface $output) {
        $view = new View();
        $output->writeln("Analysing files of $this->sourceUser ...");
        $progress = new ProgressBar($output);
        $progress->start();
Severity: Minor
Found in apps/files/lib/Command/TransferOwnership.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 getExpireList has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected static function getExpireList($time, $versions, $quotaExceeded = false) {
        $expiration = self::getExpiration();

        if ($expiration->shouldAutoExpire() && \count($versions) > 0) {
            list($toDelete, $size) = self::getAutoExpireList($time, $versions);
Severity: Minor
Found in apps/files_versions/lib/Storage.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 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

Severity
Category
Status
Source
Language