owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

Function getMountStatusForMount has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    getMountStatusForMount: function (mountData, afterCallback) {
        var self = this;
        if (typeof afterCallback !== 'function' || self.isGetMountStatusRunning) {
            return $.Deferred().resolve();
        }
Severity: Minor
Found in apps/files_external/js/statusmanager.js - About 3 hrs 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 getFailedIntegrityCheckFiles has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function getFailedIntegrityCheckFiles(): DataDisplayResponse {
        if (!$this->checker->isCodeCheckEnforced()) {
            return new DataDisplayResponse('Integrity checker has been disabled. Integrity cannot be verified.');
        }

Severity: Minor
Found in settings/Controller/CheckSetupController.php - About 3 hrs 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 getCapabilities has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function getCapabilities() {
        $res = [];

        if ($this->config->getAppValue('core', 'shareapi_enabled', 'yes') !== 'yes') {
            $res['api_enabled'] = false;
Severity: Minor
Found in apps/files_sharing/lib/Capabilities.php - About 3 hrs 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 auth has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    private function auth(RequestInterface $request, ResponseInterface $response) {
        $forcedLogout = false;
        if (!$this->request->passesCSRFCheck() &&
            $this->requiresCSRFCheck()) {
            // In case of a fail with POST we need to recheck the credentials
Severity: Minor
Found in apps/dav/lib/Connector/Sabre/Auth.php - About 3 hrs 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 getMountsForUser has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function getMountsForUser(IUser $user) {
        $loader = $this->loader;
        $mounts = \array_map(function (IMountProvider $provider) use ($user, $loader) {
            return $provider->getMountsForUser($user, $loader);
        }, $this->providers);
Severity: Minor
Found in lib/private/Files/Config/MountProviderCollection.php - About 3 hrs 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 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function run(IOutput $output) {
        if ($this->config->getSystemValue('has_internet_connection', true) !== true) {
            $link = $this->defaults->buildDocLinkToKey('admin-marketplace-apps');
            $output->info('No internet connection available - no app updates will be taken from the marketplace.');
            $output->info("How to update apps in such situation please see $link");
Severity: Minor
Found in lib/private/Repair/Apps.php - About 3 hrs 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 unshareFromSelf has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public static function unshareFromSelf($itemType, $itemOrigin, $originIsSource = false) {
        $originType = ($originIsSource) ? 'source' : 'target';
        $uid = \OCP\User::getUser();

        if ($itemType === 'file' || $itemType === 'folder') {
Severity: Minor
Found in lib/private/Share/Share.php - About 3 hrs 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 generalChecks has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    protected function generalChecks(\OCP\Share\IShare $share) {
        if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
            // We expect a valid user as sharedWith for user shares
            if (!$this->userManager->userExists($share->getSharedWith())) {
                throw new \InvalidArgumentException('SharedWith is not a valid user');
Severity: Minor
Found in lib/private/Share20/Manager.php - About 3 hrs 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 userCreateChecks has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    protected function userCreateChecks(\OCP\Share\IShare $share) {
        $userTypeHelper = new UserTypeHelper();
        $isGuestUser = $userTypeHelper->isGuestUser($share->getSharedWith());
        // Check if we can share with group members only
        // We still should be able to share with guest user even when it's not a group member
Severity: Minor
Found in lib/private/Share20/Manager.php - About 3 hrs 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 initialize has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    protected function initialize() {
        $loadedExtensions = \get_loaded_extensions();
        $packages = [];

        // Extensions scanning
Severity: Minor
Found in lib/private/App/PlatformRepository.php - About 3 hrs 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 linkTo has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function linkTo($app, $file, $args = []) {
        $frontControllerActive = (\getenv('front_controller_active') === 'true');
        $webRoot = $this->environmentHelper->getWebRoot();

        if ($app != '') {
Severity: Minor
Found in lib/private/URLGenerator.php - About 3 hrs 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 analyzeLibraries has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    private function analyzeLibraries(array $dependencies) {
        $missing = [];
        if (!isset($dependencies['lib'])) {
            return $missing;
        }
Severity: Minor
Found in lib/private/App/DependencyAnalyzer.php - About 3 hrs 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 install has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function install($options) {
        $l = $this->l10n;

        $error = [];
        $dbType = $options['dbtype'];
Severity: Minor
Found in lib/private/Setup.php - About 3 hrs 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 removeListener has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function removeListener($scope = null, $method = null, callable $callback = null) {
        $names = [];
        $allNames = \array_keys($this->listeners);
        if ($scope and $method) {
            $name = $scope . '::' . $method;
Severity: Minor
Found in lib/private/Hooks/EmitterTrait.php - About 3 hrs 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 changeSchema has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function changeSchema(Schema $schema, array $options) {
        $prefix = $options['tablePrefix'];

        if (!$schema->hasTable("{$prefix}addressbookchanges")) {
            $addressBookChangesTable = $schema->createTable("{$prefix}addressbookchanges");
Severity: Minor
Found in core/Migrations/Version20170101010100.php - About 3 hrs 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

File Manager.php has 299 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * @author Björn Schießle <bjoern@schiessle.org>
 * @author Joas Schilling <coding@schilljs.com>
 * @author Thomas Müller <thomas.mueller@tmit.eu>
Severity: Minor
Found in lib/private/Activity/Manager.php - About 3 hrs to fix

    Method handleGetProperties has 79 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function handleGetProperties(PropFind $propFind, \Sabre\DAV\INode $node) {
            $httpRequest = $this->server->httpRequest;
    
            if ($node instanceof \OCA\DAV\Connector\Sabre\Node) {
                if (!$node->getFileInfo()->isReadable()) {
    Severity: Major
    Found in apps/dav/lib/Connector/Sabre/FilesPlugin.php - About 3 hrs to fix

      Method create has 79 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function create() {
              $isConnectionParametersSupported = $this->isConnectionParametersSupported();
      
              if ($config = $this->config->getValue('redis.cluster', [])) {
                  if (!\class_exists('RedisCluster')) {
      Severity: Major
      Found in lib/private/RedisFactory.php - About 3 hrs to fix

        Method checkReshare has 79 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private static function checkReshare($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions, $itemSourceName, $expirationDate) {
                $backend = self::getBackend($itemType);
        
                $l = \OC::$server->getL10N('lib');
                $result = [];
        Severity: Major
        Found in lib/private/Share/Share.php - About 3 hrs to fix

          File versionstabview.js has 298 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*
           * Copyright (c) 2015
           *
           * This file is licensed under the Affero General Public License version 3
           * or later.
          Severity: Minor
          Found in apps/files_versions/js/versionstabview.js - About 3 hrs to fix
            Severity
            Category
            Status
            Source
            Language