owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

Method showFile has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function showFile($fileId, $details = null) {
        $uid = $this->userSession->getUser()->getUID();
        $baseFolder = $this->rootFolder->get($uid . '/files/');
        '@phan-var \OCP\Files\Folder $baseFolder';
        $files = $baseFolder->getById($fileId);
Severity: Minor
Found in apps/files/lib/Controller/ViewController.php - About 1 hr to fix

    Method __construct has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function __construct(
            $globalPrefix,
            ILogger $logger,
            $localCacheClass = null,
            $distributedCacheClass = null,
    Severity: Minor
    Found in lib/private/Memcache/Factory.php - About 1 hr to fix

      Method hasUpdated has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function hasUpdated($path, $time) {
              $this->init();
              $path = $this->cleanPath($path);
              try {
                  // force refresh for $path
      Severity: Minor
      Found in lib/private/Files/Storage/DAV.php - About 1 hr to fix

        Method getThumbnail has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getThumbnail(File $file, $maxX, $maxY, $scalingUp) {
                $stream = $file->fopen('r');
                $content = \stream_get_contents($stream, 2048);
                \fclose($stream);
        
        
        Severity: Minor
        Found in lib/private/Preview/TXT.php - About 1 hr to fix

          Method getAllSharedWith has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getAllSharedWith($userId, $node) {
                  // Create array of sharedWith objects (target user -> $userId or group of which user is a member
                  $user = $this->userManager->get($userId);
          
                  // Check if user is member of some groups and chunk them
          Severity: Minor
          Found in lib/private/Share20/DefaultShareProvider.php - About 1 hr to fix

            Method createConnectionParams has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function createConnectionParams() {
                    $type = $this->config->getValue('dbtype', 'sqlite');
            
                    $connectionParams = [
                        'user' => $this->config->getValue('dbuser', ''),
            Severity: Minor
            Found in lib/private/DB/ConnectionFactory.php - About 1 hr to fix

              Function rebuildNavigation has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  rebuildNavigation: function() {
                      $.getJSON(OC.filePath('settings', 'ajax', 'navigationdetect.php')).done(function(response){
                          if(response.status === 'success'){
                              var idsToKeep = {};
                              var navEntries=response.nav_entries;
              Severity: Minor
              Found in settings/js/admin-apps.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 prompt has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  prompt: function (text, title, callback, modal, name, password, buttonDeclineText, buttonConfirmText) {
                      return $.when(this._getMessageTemplate()).then(function ($tmpl) {
                          var dialogName = 'oc-dialog-' + OCdialogs.dialogsCounter + '-content';
                          var dialogId = '#' + dialogName;
                          var $dlg = $tmpl.octemplate({
              Severity: Minor
              Found in core/js/oc-dialogs.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 testRemoteUrl has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function testRemoteUrl(IClientService $clientService, string $remote) {
                      $parsed_host = parse_url($remote, PHP_URL_HOST);
                      $parsed_port = parse_url($remote, PHP_URL_PORT);
                      if (\is_string($parsed_host)) {
                          $remote = $parsed_host;
              Severity: Minor
              Found in apps/files_sharing/lib/External/Manager.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 checkStorageAvailability has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function checkStorageAvailability() {
                      // WARNING: Disabling this setting is recommended only in tightly integrated federated setups as temporarly setting,
                      // should NOT be used in decentralized federation setup. It could cause bad user experience when dealing
                      // with deleted external shares
                      // NOTE: This allows administrator to disable cleanup of invalid shares so only manual removal by user or admin is possible,
              Severity: Minor
              Found in apps/files_sharing/lib/External/Storage.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 updateShareState has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function updateShareState($id, $state) {
                      $eventName = '';
                      if ($state === Share::STATE_ACCEPTED) {
                          $eventName = 'accept';
                      } elseif ($state === Share::STATE_REJECTED) {
              Severity: Minor
              Found in apps/files_sharing/lib/Controller/Share20OcsController.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 copy_recursive has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  private static function copy_recursive($source, $destination, View $view) {
                      $size = 0;
                      if ($view->is_dir($source)) {
                          $view->mkdir($destination);
                          $view->touch($destination, $view->filemtime($source));
              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 expireTrash has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function expireTrash(string $uid) {
                      $trashBinSize = Trashbin::getTrashbinSize($uid);
                      $availableSpace = $this->quota->calculateFreeSpace($trashBinSize, $uid);
              
                      // delete all files older then $retention_obligation
              Severity: Minor
              Found in apps/files_trashbin/lib/TrashExpiryManager.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 getCalendarsForUser has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getCalendarsForUser($principalUri) {
                      $principalUriOriginal = $principalUri;
                      $principalUri = $this->convertPrincipal($principalUri, true);
                      $fields = \array_values($this->propertyMap);
                      $fields[] = 'id';
              Severity: Minor
              Found in apps/dav/lib/CalDAV/CalDavBackend.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 getChild has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getChild($name) {
                      // Special nodes
                      if ($name === 'inbox' && $this->caldavBackend instanceof SchedulingSupport) {
                          return new Inbox($this->caldavBackend, $this->principalInfo['uri']);
                      }
              Severity: Minor
              Found in apps/dav/lib/CalDAV/CalendarHome.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 httpGet has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function httpGet(RequestInterface $request, ResponseInterface $response) {
                      // Only handle valid files
                      $node = $this->tree->getNodeForPath($request->getPath());
                      if (!($node instanceof IFile)) {
                          return;
              Severity: Minor
              Found in apps/dav/lib/Connector/Sabre/FilesPlugin.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 parseRetentionObligation has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function parseRetentionObligation() {
                      $splitValues = \explode(',', $this->retentionObligation);
                      if (!isset($splitValues[0])) {
                          $minValue = 'auto';
                      } else {
              Severity: Minor
              Found in apps/files_versions/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 renameOrCopy has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function renameOrCopy($sourcePath, $targetPath, $operation) {
                      list($sourceOwner, $sourcePath) = self::getSourcePathAndUser($sourcePath);
              
                      // it was a upload of a existing file if no old path exists
                      // in this case the pre-hook already called the store method and we can
              Severity: Minor
              Found in apps/files_versions/lib/Storage.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 pixelArrayToImage has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function pixelArrayToImage() {
                      $x = 0;
                      $y = 0;
                      foreach ($this->pixelArray as $pixelRow) {
                          foreach ($pixelRow as $column) {
              Severity: Minor
              Found in lib/private/Image/BmpToResource.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

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

                      IL10N $l,
                      IAppManager $appManager,
                      IUserSession $userSession,
                      ILogger $logger,
                      IGroupManager $groupManager,
              Severity: Major
              Found in lib/private/Settings/SettingsManager.php - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language