owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

Method getUidAndFilename has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getUidAndFilename($path) {
        list($storage, $internalPath) = $this->rootView->resolvePath($path);

        $absMountPoint = $this->rootView->getMountPoint($path);
        $parts = \explode('/', $absMountPoint);
Severity: Minor
Found in lib/private/Encryption/Util.php - About 1 hr to fix

    Method set has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function set($data) {
            if ($data instanceof IImage) {
                $img = $data;
                $data = $img->data();
            } else {
    Severity: Minor
    Found in lib/private/Avatar.php - About 1 hr to fix

      Method getForObject has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getForObject(
              $objectType,
              $objectId,
              $limit = 0,
              $offset = 0,
      Severity: Minor
      Found in lib/private/Comments/Manager.php - About 1 hr to fix

        Method convertDB has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function convertDB(Connection $fromDB, Connection $toDB, array $tables, InputInterface $input, OutputInterface $output) {
                $this->config->setSystemValue('maintenance', true);
                try {
                    $fromSchema = $fromDB->createSchema();
                    // copy table rows
        Severity: Minor
        Found in core/Command/Db/ConvertType.php - About 1 hr to fix

          Method execute has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function execute(InputInterface $input, OutputInterface $output): int {
                  $privateKeyPath = $input->getOption('privateKey');
                  $keyBundlePath = $input->getOption('certificate');
                  $path = $input->getOption('path');
                  if ($privateKeyPath === null || $keyBundlePath === null || $path === null) {
          Severity: Minor
          Found in core/Command/Integrity/SignCore.php - About 1 hr to fix

            Method execute has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function execute(InputInterface $input, OutputInterface $output): int {
                    if (!$this->connection->getDatabasePlatform() instanceof MySqlPlatform) {
                        $output->writeln("<error>This command is only valid for MySQL/MariaDB databases.</error>");
                        return 1;
                    }
            Severity: Minor
            Found in core/Command/Db/RestoreDefaultRowFormat.php - About 1 hr to fix

              Method execute has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function execute(InputInterface $input, OutputInterface $output): int {
                      $importFile = $input->getArgument('file');
                      if ($importFile !== null) {
                          $content = $this->getArrayFromFile($importFile);
                      } else {
              Severity: Minor
              Found in core/Command/Config/Import.php - About 1 hr to fix

                Method checkInput has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function checkInput(InputInterface $input) {
                        $uid = $input->getArgument('uid');
                        if (!$input->getOption('ignore-missing-user') && !$this->userManager->userExists($uid)) {
                            throw new \InvalidArgumentException('The user "' . $uid . '" does not exist.');
                        }
                Severity: Minor
                Found in core/Command/User/Setting.php - About 1 hr to fix

                  Method showChallenge has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function showChallenge($challengeProviderId, $redirect_url) {
                          $user = $this->userSession->getUser();
                          $provider = $this->twoFactorManager->getProvider($user, $challengeProviderId);
                          if ($provider === null) {
                              return new RedirectResponse($this->urlGenerator->linkToRoute('core.TwoFactorChallenge.selectChallenge'));
                  Severity: Minor
                  Found in core/Controller/TwoFactorChallengeController.php - About 1 hr to fix

                    Function fallBackCallBack has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        fallBackCallBack:function(type,data){
                            var i;
                            // ignore messages that might appear after closing
                            if (this.closed) {
                                return;
                    Severity: Minor
                    Found in core/js/eventsource.js - About 1 hr 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 isTargetAllowed has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function isTargetAllowed($target) {
                            $currentMount = $this->getMountPoint();
                            // note: $currentMount has a trailing slash. It doesn't matter for the check below
                            $isRename = \dirname($currentMount) === \dirname($target);
                    
                    
                    Severity: Minor
                    Found in apps/files_sharing/lib/SharedMount.php - About 1 hr 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 formatUserForIndex has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function formatUserForIndex(IUser $user, array $userGroups = null) {
                            // TODO: eliminate this encryption specific code below and somehow
                            // hook in additional user info from other apps
                    
                            // recovery isn't possible if admin or user has it disabled and encryption
                    Severity: Minor
                    Found in settings/Controller/UsersController.php - About 1 hr 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 splitUserRemote has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function splitUserRemote($address) {
                            if (\strpos($address, '@') === false) {
                                throw new \Exception('Invalid Federated Cloud ID');
                            }
                    
                    
                    Severity: Minor
                    Found in apps/files_sharing/lib/Controller/ShareesController.php - About 1 hr 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 search has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function search($search = '', $itemType = null, $page = 1, $perPage = 200) {
                            if ($perPage <= 0) {
                                return [ 'statuscode' => Http::STATUS_BAD_REQUEST,
                                    'message' => 'Invalid perPage argument'];
                            }
                    Severity: Minor
                    Found in apps/files_sharing/lib/Controller/ShareesController.php - About 1 hr 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 isExpired has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function isExpired($timestamp, $quotaExceeded = false) {
                            // No expiration if disabled
                            if (!$this->isEnabled()) {
                                return false;
                            }
                    Severity: Minor
                    Found in apps/files_trashbin/lib/Expiration.php - About 1 hr 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 getProperties has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getProperties($properties) {
                            if (($properties === null) || ($properties === [])) {
                                $properties = \array_keys($this->properties);
                            }
                    
                    
                    Severity: Minor
                    Found in apps/comments/lib/Dav/CommentNode.php - About 1 hr 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 getVersionsFromTrash has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static function getVersionsFromTrash($filename, $timestamp, $user) {
                            $view = new View('/' . $user . '/files_trashbin/versions');
                            $versions = [];
                    
                            //force rescan of versions, local storage may not have updated the cache
                    Severity: Minor
                    Found in apps/files_trashbin/lib/Trashbin.php - About 1 hr 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 onReport has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function onReport($reportName, $report, $uri) {
                            $node = $this->server->tree->getNodeForPath($uri);
                            if (!$node instanceof EntityCollection || $reportName !== self::REPORT_NAME) {
                                throw new ReportNotSupported();
                            }
                    Severity: Minor
                    Found in apps/comments/lib/Dav/CommentsPlugin.php - About 1 hr 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 createConfidentialObject has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static function createConfidentialObject($calData) {
                            $vObject = Reader::read($calData);
                    
                            /** @var Component $vElement */
                            $vElement = null;
                    Severity: Minor
                    Found in apps/dav/lib/CalDAV/CalendarObject.php - About 1 hr 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 createFederatedShare has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function createFederatedShare(IShare $share) {
                            $token = $this->tokenHandler->generateToken();
                            $shareId = $this->addShareToDB(
                                $share->getNodeId(),
                                $share->getNodeType(),
                    Severity: Minor
                    Found in apps/federatedfilesharing/lib/FederatedShareProvider.php - About 1 hr 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