owncloud/core

View on GitHub

Showing 3,236 of 4,502 total issues

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

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

    public static function humanFileSize($bytes) {
        if ($bytes < 0) {
            return "?";
        }
        if ($bytes < 1024) {
Severity: Minor
Found in lib/private/legacy/helper.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 getGlobalStorageInfo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private static function getGlobalStorageInfo() {
        $quota = OC_Util::getUserQuota(\OCP\User::getUser());

        $rootInfo = \OC\Files\Filesystem::getFileInfo('', 'ext');
        $used = $rootInfo['size'];
Severity: Minor
Found in lib/private/legacy/helper.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 log has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function log($message, $level) {
        switch ($level) {
            case 'debug':
                $level = \OCP\Util::DEBUG;
                break;
Severity: Minor
Found in lib/private/AppFramework/DependencyInjection/DIContainer.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 getShortFooter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getShortFooter() {
        if ($this->themeExist('getShortFooter')) {
            $footer = $this->theme->getShortFooter();
        } else {
            $footer  = '<a href="' . $this->getBaseUrl() . '" target="_blank" rel="noreferrer">' . $this->getEntity() . '</a>';
Severity: Minor
Found in lib/private/legacy/defaults.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 isManipulation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function isManipulation($sql) {
        $selectOccurrence = \stripos($sql, 'SELECT');
        if ($selectOccurrence !== false && $selectOccurrence < 10) {
            return false;
        }
Severity: Minor
Found in lib/private/legacy/db.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 findFirstActiveUsedBackend has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private static function findFirstActiveUsedBackend() {
        foreach (self::$_usedBackends as $backend) {
            if ($backend instanceof OCP\Authentication\IApacheBackend) {
                if ($backend->isSessionActive()) {
                    return $backend;
Severity: Minor
Found in lib/private/legacy/user.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