owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

Function getAffectedUsers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    private function getAffectedUsers(IShare $share) {
        $users = [];
        if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
            // notify all group members
            $group = $this->groupManager->get($share->getSharedWith());
Severity: Minor
Found in apps/files_sharing/lib/Service/NotificationPublisher.php - About 45 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

Avoid deeply nested control flow statements.
Open

                            if(self.hasFilter(getCurrentApp())) {
                                self.getFilter(getCurrentApp())(query);
                            }
Severity: Major
Found in core/search/js/search.js - About 45 mins to fix

    Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            $appName,
            IRequest $request,
            IGroupManager $groupManager,
            IUserSession $userSession,
            $isAdmin,
    Severity: Minor
    Found in settings/Controller/GroupsController.php - About 45 mins to fix

      Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              $appName,
              IRequest $request,
              Manager $externalManager,
              IConfig $config,
              ILogger $logger,
      Severity: Minor
      Found in apps/files_sharing/lib/Controller/RemoteOcsController.php - About 45 mins to fix

        Method translate has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function translate($app, $text, $params, $stripPath, $highlightParams, $languageCode) {
        Severity: Minor
        Found in apps/files_sharing/lib/Activity.php - About 45 mins to fix

          Function moveShareToShare has a Cognitive Complexity of 8 (exceeds 5 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 45 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

          Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  IManager $shareManager,
                  IConfig $config,
                  UserSearch $userSearch,
                  IL10N $l10n,
                  SharingAllowlist $sharingAllowlist,
          Severity: Minor
          Found in apps/files_sharing/lib/Capabilities.php - About 45 mins to fix

            Function rename has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function rename($path1, $path2) {
                    $isPartFile = \pathinfo($path1, PATHINFO_EXTENSION) === 'part';
                    $targetExists = $this->file_exists($path2);
                    $sameFolder = \dirname($path1) === \dirname($path2);
            
            
            Severity: Minor
            Found in apps/files_sharing/lib/SharedStorage.php - About 45 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

            Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    $appName,
                    IRequest $request,
                    ISettingsManager $settingsManager,
                    IURLGenerator $urlGenerator,
                    IGroupManager $groupManager,
            Severity: Minor
            Found in settings/Controller/SettingsPageController.php - About 45 mins to fix

              Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      \OCP\L10N\IFactory $factory,
                      INotificationManager $notificationManager,
                      IShareManager $shareManager,
                      IGroupManager $groupManager,
                      IUserManager $userManager,
              Severity: Minor
              Found in apps/files_sharing/lib/Notifier.php - About 45 mins to fix

                Function dirRecursiveCheck has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function dirRecursiveCheck(Folder $dirInfo) {
                        if (!$this->checkFileInfo($dirInfo)) {
                            return false;
                        }
                        // If any of elements cannot be downloaded, prevent whole download
                Severity: Minor
                Found in apps/files_sharing/lib/ViewOnly.php - About 45 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

                Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        \OCP\IDBConnection                 $connection,
                        \OC\Files\Mount\Manager            $mountManager,
                        \OCP\Files\Storage\IStorageFactory $storageLoader,
                        IManager                           $notificationManager,
                        EventDispatcherInterface           $eventDispatcher,
                Severity: Minor
                Found in apps/files_sharing/lib/External/Manager.php - About 45 mins to fix

                  Function getChildren has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function getChildren($itemSource) {
                          $children = [];
                          $parents = [$itemSource];
                          $query = \OCP\DB::prepare('SELECT `id` FROM `*PREFIX*mimetypes` WHERE `mimetype` = ?');
                          $result = $query->execute(['httpd/unix-directory']);
                  Severity: Minor
                  Found in apps/files_sharing/lib/ShareBackend/Folder.php - About 45 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

                  Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          IClient $httpClient = null,
                          IURLGenerator $urlGenerator = null,
                          IJobList $jobList = null,
                          TrustedServers $trustedServers = null,
                          ILogger $logger = null,
                  Severity: Minor
                  Found in apps/federation/lib/BackgroundJob/GetSharedSecret.php - About 45 mins to fix

                    Method retainVersions has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        private static function retainVersions($filename, $owner, $ownerPath, $timestamp, $sourceStorage = null, $forceCopy = false) {
                    Severity: Minor
                    Found in apps/files_trashbin/lib/Trashbin.php - About 45 mins to fix

                      Function linkShareAuth has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function linkShareAuth(\OCP\Share\IShare $share, $password = null) {
                              $beforeEvent = new GenericEvent(null, ['shareObject' => $share]);
                              $this->eventDispatcher->dispatch($beforeEvent, 'share.beforelinkauth');
                              if ($password !== null) {
                                  if ($this->shareManager->checkPassword($share, $password)) {
                      Severity: Minor
                      Found in apps/files_sharing/lib/Controllers/ShareController.php - About 45 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

                      Method translate has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          public function translate($app, $text, $params, $stripPath, $highlightParams, $languageCode) {
                      Severity: Minor
                      Found in apps/systemtags/lib/Activity/Extension.php - About 45 mins to fix

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

                            protected function run($argument) {
                                $target = $argument['url'];
                                $source = $this->urlGenerator->getAbsoluteURL('/');
                                $source = \rtrim($source, '/');
                                $token = $argument['token'];
                        Severity: Minor
                        Found in apps/federation/lib/BackgroundJob/RequestSharedSecret.php - About 45 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

                        Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                $appName,
                                IRequest $request,
                                \OCA\Files_Sharing\External\Manager $externalManager,
                                IClientService $clientService,
                                EventDispatcherInterface $eventDispatcher,
                        Severity: Minor
                        Found in apps/files_sharing/lib/Controllers/ExternalSharesController.php - About 45 mins to fix

                          Method translate has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              public function translate($app, $text, $params, $stripPath, $highlightParams, $languageCode) {
                          Severity: Minor
                          Found in apps/comments/lib/Activity/Extension.php - About 45 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language