owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

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

    public function list(): array {
        $mimeTypes = [];

        foreach (self::$apps as $app_name => $app_info) {
            if ($this->appManager->isEnabledForUser($app_info['oc_app_name'])) {
Severity: Minor
Found in core/Controller/AppRegistryController.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 manageMountPointError has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    manageMountPointError: function (name) {
        this.getMountStatus($.proxy(function (allMountStatus) {
            if (allMountStatus.hasOwnProperty(name) && allMountStatus[name].status > 0 && allMountStatus[name].status < 7) {
                var mountData = allMountStatus[name];
                if (mountData.type === "system") {
Severity: Minor
Found in apps/files_external/js/statusmanager.js - About 1 hr to fix

    Function _onDropOnBreadCrumb has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            _onDropOnBreadCrumb: function( event, ui ) {
                var self = this;
                var $target = $(event.target);
                if (!$target.is('.crumb')) {
                    $target = $target.closest('.crumb');
    Severity: Minor
    Found in apps/files/js/filelist.js - About 1 hr to fix

      Function elementToFile has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              elementToFile: function($el){
                  $el = $($el);
                  var data = {
                      id: parseInt($el.attr('data-id'), 10),
                      name: $el.attr('data-file'),
      Severity: Minor
      Found in apps/files/js/filelist.js - About 1 hr to fix

        Function getDimensions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function getDimensions( elem ) {
            var raw = elem[ 0 ];
            if ( raw.nodeType === 9 ) {
                return {
                    width: elem.width(),
        Severity: Minor
        Found in core/js/js.js - About 1 hr to fix

          Method getMountsForUser has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getMountsForUser(IUser $user, IStorageFactory $storageFactory) {
                  $requiredShareTypes = [\OCP\Share::SHARE_TYPE_USER, \OCP\Share::SHARE_TYPE_GROUP];
                  $shares = $this->shareManager->getAllSharedWith($user->getUID(), $requiredShareTypes, null);
                  
                  // filter out excluded shares and group shares that includes self
          Severity: Minor
          Found in apps/files_sharing/lib/MountProvider.php - About 1 hr to fix

            Method moveShareToShare has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private static function moveShareToShare($path) {
                    $userFolder = \OC::$server->getUserFolder();
            
                    // If the user folder can't be constructed (e.g. link share) just return.
                    if ($userFolder === null) {
            Severity: Minor
            Found in apps/files_sharing/lib/Updater.php - About 1 hr to fix

              Method requestSharedSecret has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function requestSharedSecret($url, $token) {
                      if ($this->trustedServers->isTrustedServer($url) === false) {
                          $this->logger->error('remote server not trusted (' . $url . ') while requesting shared secret', ['app' => 'federation']);
                          return ['statuscode' => Http::STATUS_FORBIDDEN];
                      }
              Severity: Minor
              Found in apps/federation/lib/Controller/OCSAuthAPIController.php - About 1 hr to fix

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

                    protected function execute(InputInterface $input, OutputInterface $output): int {
                        $retentionEnabled = $this->trashExpiryManager->retentionEnabled();
                        if (!$retentionEnabled) {
                            $output->writeln("Auto expiration is configured - expiration will be handled automatically.");
                            return 1;
                Severity: Minor
                Found in apps/files_trashbin/lib/Command/ExpireTrash.php - About 1 hr to fix

                  Method createSubscription has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function createSubscription($principalUri, $uri, array $properties) {
                          if (!isset($properties['{http://calendarserver.org/ns/}source'])) {
                              throw new Forbidden('The {http://calendarserver.org/ns/}source property is required when creating subscriptions');
                          }
                  
                  
                  Severity: Minor
                  Found in apps/dav/lib/CalDAV/CalDavBackend.php - About 1 hr to fix

                    Method validateUserPass has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function validateUserPass($username, $password) {
                            if (\trim($username) === '') {
                                return false;
                            }
                            if ($this->userSession->isLoggedIn() &&
                    Severity: Minor
                    Found in apps/dav/lib/Connector/Sabre/Auth.php - About 1 hr to fix

                      Method discover has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function discover($remote) {
                              // Check if something is in the cache
                              if ($cacheData = $this->cache->get($remote)) {
                                  return \json_decode($cacheData, true);
                              }
                      Severity: Minor
                      Found in apps/federatedfilesharing/lib/DiscoveryManager.php - About 1 hr to fix

                        Method onReport has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function onReport($reportName, $report, $uri) {
                                $reportTargetNode = $this->server->tree->getNodeForPath($uri);
                                if (!$reportTargetNode instanceof Directory || $reportName !== self::REPORT_NAME) {
                                    return;
                                }
                        Severity: Minor
                        Found in apps/dav/lib/Connector/Sabre/FilesReportPlugin.php - About 1 hr to fix

                          Method fopen has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function fopen($path, $mode) {
                                  try {
                                      $absPath = $this->absPath($path);
                                      switch ($mode) {
                                          case 'r':
                          Severity: Minor
                          Found in apps/files_external/lib/Lib/Storage/SFTP.php - About 1 hr to fix

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

                                protected function execute(InputInterface $input, OutputInterface $output): int {
                                    $maxAge = $this->expiration->getMaxAgeAsTimestamp();
                                    if (!$maxAge) {
                                        $output->writeln("Auto expiration is configured - expiration will be handled automatically.");
                                        return 1;
                            Severity: Minor
                            Found in apps/files_versions/lib/Command/ExpireVersions.php - About 1 hr to fix

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

                                  protected function execute(InputInterface $input, OutputInterface $output) {
                                      if ($input->getOption('show-candidates')) {
                                          $this->showCandidates($output);
                                          return 0;
                                      }
                              Severity: Minor
                              Found in apps/files/lib/Command/RemoveStorageCache.php - About 1 hr to fix

                                Method rmdir has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function rmdir($path) {
                                        $this->log('enter: '.__FUNCTION__."($path)");
                                
                                        if ($this->isRootDir($path)) {
                                            $this->log("refusing to delete \"$path\"");
                                Severity: Minor
                                Found in apps/files_external/lib/Lib/Storage/SMB.php - About 1 hr to fix

                                  Method getFavoriteFilePaths has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function getFavoriteFilePaths($user) {
                                          $tags = $this->tagManager->load('files', [], false, $user);
                                          $favorites = $tags->getFavorites();
                                  
                                          if (empty($favorites)) {
                                  Severity: Minor
                                  Found in apps/files/lib/ActivityHelper.php - About 1 hr to fix

                                    Method sendMail has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        public static function sendMail(
                                            $toaddress,
                                            $toname,
                                            $subject,
                                            $mailtext,
                                    Severity: Minor
                                    Found in lib/public/Util.php - About 1 hr to fix

                                      Method assignTags has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          public function assignTags($objId, $objectType, $tagIds) {
                                              if (!\is_array($tagIds)) {
                                                  $tagIds = [$tagIds];
                                              }
                                      
                                      
                                      Severity: Minor
                                      Found in lib/private/SystemTag/SystemTagObjectMapper.php - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language