owncloud/core

View on GitHub

Showing 4,502 of 4,502 total issues

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

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

    public function getOwncloudLicense(): ?ILicense {
        $licenseClass = $this->config->getSystemValue('license-class', BasicLicense::class);
        if (!\class_exists($licenseClass)) {
            throw new HintException("Unknown license $licenseClass");
        }
Severity: Minor
Found in lib/private/License/LicenseFetcher.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 validateExpireDate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private static function validateExpireDate($expireDate, $shareTime, $itemType, $itemSource) {
        $l = \OC::$server->getL10N('lib');
        $date = new \DateTime($expireDate);
        $today = new \DateTime('now');

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

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

    public function showPreview($mimeTypeForHeaders = null) {
        // Check if file is valid
        if ($this->isFileValid() === false) {
            throw new NotFoundException('File not found.');
        }
Severity: Minor
Found in lib/private/Preview.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 buildCachePath has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function buildCachePath($maxX = null, $maxY = null) {
        if ($maxX === null) {
            $maxX = $this->getMaxX();
        }
        if ($maxY === null) {
Severity: Minor
Found in lib/private/Preview.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 pathCreateChecks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function pathCreateChecks($path) {
        // Make sure that we do not share a path that contains a shared mountpoint
        if ($path instanceof \OCP\Files\Folder) {
            $mounts = $this->mountManager->findIn($path->getPath());
            foreach ($mounts as $mount) {
Severity: Minor
Found in lib/private/Share20/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 getAllSharesBy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getAllSharesBy($userId, $shareTypes, $nodeIDs, $reshares) {
        $shares = [];
        $qb = $this->dbConn->getQueryBuilder();

        $qb->select('*')
Severity: Minor
Found in lib/private/Share20/DefaultShareProvider.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 registerBackend has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function registerBackend($itemType, $class, $collectionOf = null, $supportedFileExtensions = null) {
        if (self::isEnabled()) {
            if (!isset(self::$backendTypes[$itemType])) {
                self::$backendTypes[$itemType] = [
                    'class' => $class,
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

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

    public function run(IOutput $out) {
        $view = new View('/');
        $children = $view->getDirectoryContent('/');

        foreach ($children as $child) {
Severity: Minor
Found in lib/private/Repair/Preview.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 setValues has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function setValues(array $configs) {
        if ($this->isReadOnly()) {
            throw new \Exception('Config file is read only.');
        }
        $needsUpdate = false;
Severity: Minor
Found in lib/private/Config.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 getId has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getId() {
        // allow clients to provide a request id
        if (isset($this->server['HTTP_X_REQUEST_ID'])) {
            $reqId = $this->server['HTTP_X_REQUEST_ID'];
            if (\strlen($reqId) > 19
Severity: Minor
Found in lib/private/AppFramework/Http/Request.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 passesCSRFCheck has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function passesCSRFCheck() {
        if ($this->csrfTokenManager === null) {
            return false;
        }

Severity: Minor
Found in lib/private/AppFramework/Http/Request.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 keySetPreparation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function keySetPreparation($path) {
        // If the file resides within a subdirectory, create it
        if (!$this->view->file_exists($path)) {
            $sub_dirs = \explode('/', \ltrim($path, '/'));
            $dir = '';
Severity: Minor
Found in lib/private/Encryption/Keys/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 detectImageTypeFromStream has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function detectImageTypeFromStream($stream) {
        $detectedType = false;

        \rewind($stream);
        $bytes = \fread($stream, 2);
Severity: Minor
Found in lib/private/legacy/image.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 shouldUpgrade has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function shouldUpgrade($app) {
        $versions = self::getAppVersions();
        $info = \OC::$server->getAppManager()->getAppInfo($app);

        if ($info && isset($versions[$app])) {
Severity: Minor
Found in lib/private/legacy/app.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