owncloud/core

View on GitHub

Showing 3,236 of 4,502 total issues

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

    protected function parseRawHeader($rawHeader) {
        $result = [];
        if (\substr($rawHeader, 0, \strlen(Util::HEADER_START)) === Util::HEADER_START) {
            $header = $rawHeader;
            $endAt = \strpos($header, Util::HEADER_END);
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 remove has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function remove($path) {
        if (!$this->enabled or Scanner::isPartialFile($path)) {
            return;
        }

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

    public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true) {
        if ($reuse === -1) {
            $reuse = ($recursive === self::SCAN_SHALLOW) ? self::REUSE_ETAG | self::REUSE_SIZE : self::REUSE_ETAG;
        }
        if ($lock && $this->storage->instanceOfStorage(ILockingStorage::class)) {
Severity: Minor
Found in lib/private/Files/Cache/Scanner.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 getMimeType has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getMimeType($path) {
        try {
            $response = $this->propfind($path);
            if ($response === false) {
                return false;
Severity: Minor
Found in lib/private/Files/Storage/DAV.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 addToCache has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function addToCache(ICachedMountInfo $mount) {
        if ($mount->getStorageId() !== -1) {
            try {
                $rows = $this->connection->insertIfNotExist(
                    '*PREFIX*mounts',
Severity: Minor
Found in lib/private/Files/Config/UserMountCache.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 createStorage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function createStorage(
        $mountPoint,
        $backendIdentifier,
        $authMechanismIdentifier,
        $backendOptions,
Severity: Minor
Found in lib/private/Files/External/Service/StoragesService.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 find has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function find($path) {
        \OC_Util::setupFS();
        $path = $this->formatPath($path);
        if (isset($this->mounts[$path])) {
            return $this->mounts[$path];
Severity: Minor
Found in lib/private/Files/Mount/Manager.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 unTag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function unTag($objid, $tag) {
        if (\is_string($tag) && !\is_numeric($tag)) {
            $tag = \trim($tag);
            if ($tag === '') {
                \OCP\Util::writeLog('core', __METHOD__.', Tag name is empty', \OCP\Util::DEBUG);
Severity: Minor
Found in lib/private/Tags.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 getThumbnail has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getThumbnail(File $file, $maxX, $maxY, $scalingUp) {
        $this->initCmd();
        if ($this->cmd === null) {
            return false;
        }
Severity: Minor
Found in lib/private/Preview/Office.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 isApplicable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function isApplicable(IStorageConfig $config) {
        $applicableUsers = $config->getApplicableUsers();
        $applicableGroups = $config->getApplicableGroups();

        if (\count($applicableUsers) === 0 && \count($applicableGroups) === 0) {
Severity: Minor
Found in lib/private/Files/External/Service/UserGlobalStoragesService.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 getAbsoluteMountPoints has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getAbsoluteMountPoints($uid) {
        $mountPoints = [];

        $userGlobalStoragesService = \OC::$server->getUserGlobalStoragesService();
        '@phan-var \OC\Files\External\Service\UserGlobalStoragesService $userGlobalStoragesService';
Severity: Minor
Found in lib/private/Files/External/LegacyUtil.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 verifyAppSignature has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function verifyAppSignature($appId, $path = '', $force = false) {
        try {
            if ($path === '') {
                $path = $this->appLocator->getAppPath($appId);
            }
Severity: Minor
Found in lib/private/IntegrityCheck/Checker.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 sendLinkShareMail has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function sendLinkShareMail($sender, $recipients, $link, $personalNote = null) {
        if ($this->config->getAppValue('core', 'shareapi_allow_public_notification', 'no') !== 'yes') {
            $message_t = $this->l->t('Public link mail notification is not allowed');
            throw new GenericShareException($message_t, $message_t, 403);
        }
Severity: Minor
Found in lib/private/Share/MailNotifications.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 cleanFiles has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function cleanFiles(array $files): void {
        foreach ($files as $file) {
            if (\file_exists($file)) {
                try {
                    OC_Helper::rmdirr($file);
Severity: Minor
Found in lib/private/TempManager.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 decryptIfPassword has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function decryptIfPassword(Backend $backend, AuthMechanism $auth, $key, $value) {
        $backendParameters = $backend->getParameters();
        $authParameters = $auth->getParameters();
        if (
            (
Severity: Minor
Found in lib/private/Files/External/Service/StoragesService.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 addStorage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function addStorage(IStorageConfig $newStorage) {
        $allStorages = $this->readConfig();

        $configId = $this->dbConfig->addMount(
            $newStorage->getMountPoint(),
Severity: Minor
Found in lib/private/Files/External/Service/StoragesService.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 runBackgroundScanJob has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function runBackgroundScanJob(callable $callback, $path) {
        try {
            $callback();
            \OC_Hook::emit('Scanner', 'correctFolderSize', ['path' => $path]);
            if ($this->cacheActive && $this->cache instanceof Cache) {
Severity: Minor
Found in lib/private/Files/Cache/Scanner.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 generateThumbNail has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function generateThumbNail($maxX, $maxY, $absPath, $second) {
        $extractedCover = $this->extractMp4CoverArtwork($absPath);
        if ($extractedCover !== false) {
            $tmpPath = $extractedCover;
        } else {
Severity: Minor
Found in lib/private/Preview/Movie.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function run(IOutput $out) {
        $enabledThemes = $this->getEnabledAppThemes();

        $activeTheme = '';
        if (\count($enabledThemes) >= 2) {
Severity: Minor
Found in lib/private/Repair/DisableExtraThemes.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 checkPasswordProtectedShare has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function checkPasswordProtectedShare(array $linkItem) {
        if (!isset($linkItem['share_with'])) {
            return true;
        }
        if (!isset($linkItem['share_type'])) {
Severity: Minor
Found in lib/private/Share/Share.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