owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    $notificationTargetGroups.change(function(ev) {
        var groups = ev.val || [];
        groups = JSON.stringify(groups);
        OC.AppConfig.setValue('updatenotification', 'notify_groups', groups);
    });
Severity: Major
Found in apps/updatenotification/js/admin.js and 1 other location - About 1 hr to fix
apps/files_sharing/js/settings.js on lines 24..29

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 65.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    function newFile() {
        $("#new").addClass("active");
        $(".popup.popupTop").toggle(true);
        $('#new li[data-type="file"]').trigger('click');
        removeA(keys, keyCodes.n);
Severity: Major
Found in apps/files/js/keyboardshortcuts.js and 1 other location - About 1 hr to fix
apps/files/js/keyboardshortcuts.js on lines 52..57

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 65.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    $publicShareSharersGroupsAllowlist.change(function(ev) {
        var groups = ev.val || [];
        groups = JSON.stringify(groups);
        OC.AppConfig.setValue('files_sharing', 'public_share_sharers_groups_allowlist', groups);

Severity: Major
Found in apps/files_sharing/js/settings.js and 1 other location - About 1 hr to fix
apps/updatenotification/js/admin.js on lines 65..69

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 65.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function _showMountOptionsDropdown has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _showMountOptionsDropdown: function($tr) {
        if (this._preventNextDropdown) {
            // prevented because the click was on the toggle
            this._preventNextDropdown = false;
            return;
Severity: Minor
Found in apps/files_external/js/settings.js - About 1 hr to fix

    Function _resize has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            _resize: function() {
                var i, $crumb, $ellipsisCrumb;
    
                if (!this.availableWidth) {
                    this.availableWidth = this.$el.width();
    Severity: Minor
    Found in apps/files/js/breadcrumb.js - About 1 hr to fix

      Function update has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          update: function (gid, limit) {
              if (UserList.updating) {
                  return;
              }
              if(!limit) {
      Severity: Minor
      Found in settings/js/users/users.js - About 1 hr to fix

        Function _setShareTreeUserGroupView has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                _setShareTreeUserGroupView: function() {
                    var self  = this;
                    var $list = $('<ul>', { id : 'shareTreeUserGroupList' });
        
                    if (! _.keys(self._shareTreeCache).length > 0) {
        Severity: Minor
        Found in apps/files/js/filelist.js - About 1 hr to fix

          Function render has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  render: function() {
                      if (!this.model.hasReshare()
                          || this.model.getReshareOwner() === OC.currentUser)
                      {
                          this.$el.empty();
          Severity: Minor
          Found in core/js/sharedialogresharerinfoview.js - About 1 hr to fix

            Function _moveOrCopy has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    _moveOrCopy: function(operation, path, destinationPath, allowOverwrite, headers, options) {
                        if (!path) {
                            throw 'Missing argument "path"';
                        }
                        if (!destinationPath) {
            Severity: Minor
            Found in core/js/files/client.js - About 1 hr to fix

              Method translateLong has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function translateLong($text, IL10N $l, array $params) {
                      switch ($text) {
                          case self::CREATE_TAG:
                              $params[1] = $this->convertParameterToTag($params[1], $l);
                              if ($this->actorIsCurrentUser($params[0])) {
              Severity: Minor
              Found in apps/systemtags/lib/Activity/Extension.php - About 1 hr to fix

                Method sendUpdateToRemote has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function sendUpdateToRemote($remote, $remoteId, $token, $action, $data = [], $try = 0) {
                        $ocmNotification = $this->notificationManager->convertToOcmFileNotification($remoteId, $token, $action, $data);
                        $ocmFields = $ocmNotification->toArray();
                        $url = \rtrim(
                            $this->addressHandler->removeProtocolFromUrl($remote),
                Severity: Minor
                Found in apps/federatedfilesharing/lib/Notifications.php - About 1 hr to fix

                  Method getUsersOwnCalendars has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getUsersOwnCalendars($principalUri) {
                          $principalUri = $this->convertPrincipal($principalUri, true);
                          $fields = \array_values($this->propertyMap);
                          $fields[] = 'id';
                          $fields[] = 'uri';
                  Severity: Minor
                  Found in apps/dav/lib/CalDAV/CalDavBackend.php - About 1 hr to fix

                    Method removeFromGroup has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function removeFromGroup($parameters) {
                            // Check if user is logged in
                            $loggedInUser = $this->userSession->getUser();
                            if ($loggedInUser === null) {
                                return new Result(null, API::RESPOND_UNAUTHORISED);
                    Severity: Minor
                    Found in apps/provisioning_api/lib/Users.php - About 1 hr to fix

                      Method emitPreHooks has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function emitPreHooks($exists, $path = null) {
                              if ($path === null) {
                                  $path = $this->path;
                              }
                              $hookPath = Filesystem::getView()->getRelativePath($this->fileView->getAbsolutePath($path));
                      Severity: Minor
                      Found in apps/dav/lib/Connector/Sabre/File.php - About 1 hr to fix

                        Method getACL has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function getACL() {
                                $acl = [
                                    [
                                        'privilege' => '{DAV:}all',
                                        'principal' => '{DAV:}owner',
                        Severity: Minor
                        Found in apps/dav/lib/Files/PublicFiles/PublicSharedRootNode.php - About 1 hr to fix

                          Method run has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function run(IOutput $out) {
                                  if (!$this->config->getSystemValue('installed', false)) {
                                      // Skip the migration for new installations -> nothing to migrate
                                      return;
                                  }
                          Severity: Minor
                          Found in apps/files_external/appinfo/Migrations/Version20220329110116.php - About 1 hr to fix

                            Method configure has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                protected function configure() {
                                    $this
                                        ->setName('files_external:create')
                                        ->setDescription('Create a new mount configuration')
                                        ->addOption(
                            Severity: Minor
                            Found in apps/files_external/lib/Command/Create.php - About 1 hr to fix

                              Method update has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function update(
                                      $id,
                                      $mountPoint,
                                      $backend,
                                      $authMechanism,
                              Severity: Minor
                              Found in apps/files_external/lib/Controller/UserStoragesController.php - About 1 hr to fix

                                Method expireOlderThanMaxForUser has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public static function expireOlderThanMaxForUser($uid) {
                                        $expiration = self::getExpiration();
                                        $threshold = $expiration->getMaxAgeAsTimestamp();
                                        $versions = self::getFileHelper()->getAllVersions($uid);
                                        if (!$threshold || !\array_key_exists('all', $versions)) {
                                Severity: Minor
                                Found in apps/files_versions/lib/Storage.php - About 1 hr to fix

                                  Method getQueryForFilter has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function getQueryForFilter($filter) {
                                          $user = $this->activityManager->getCurrentUserId();
                                          // Display actions from all files
                                          if ($filter === self::FILTER_FILES) {
                                              return ['`app` = ?', [self::APP_FILES]];
                                  Severity: Minor
                                  Found in apps/files/lib/Activity.php - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language