owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

File AvatarController.php has 251 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * @author Joas Schilling <coding@schilljs.com>
 * @author Lukas Reschke <lukas@statuscode.ch>
 * @author Martin Mattel <martin.mattel@diemattels.at>
Severity: Minor
Found in core/Controller/AvatarController.php - About 2 hrs to fix

    Function _handleFileTreeEntry has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            _handleFileTreeEntry: function (entry, path) {
                var that = this,
                    dfd = $.Deferred(),
                    entries = [],
                    dirReader,
    Severity: Minor
    Found in apps/files/js/jquery.fileupload.js - About 2 hrs to fix

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

              render: function () {
                  this.$el.html(this.template({
                      cid: this.cid,
                      urlLabel: t('core', 'Link'),
                      addLinkText: t('core', 'Create public link'),
      Severity: Minor
      Found in core/js/sharedialoglinklistview.js - About 2 hrs to fix

        Function _getUsersForBatchAction has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                _getUsersForBatchAction: function(search) {
                    var view = this;
                    var foundUsers = [];
                    var notFound = [];
                    var promises = [];
        Severity: Minor
        Found in core/js/sharedialogview.js - About 2 hrs to fix

          Method setEnabled has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function setEnabled($id, $enabled) {
                  $userId = $this->userSession->getUser()->getUID();
                  $user = $this->userManager->get($id);
                  '@phan-var \OC\Group\Manager $this->groupManager';
          
          
          Severity: Minor
          Found in settings/Controller/UsersController.php - About 2 hrs to fix

            Method xmlDeserialize has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function xmlDeserialize(Reader $reader) {
                    $elems = (array)$reader->parseInnerTree([
                        '{DAV:}prop' => KeyValue::class,
                        '{http://owncloud.org/ns}filter-rules' => Base::class,
                        '{http://owncloud.org/ns}search' => KeyValue::class,
            Severity: Minor
            Found in apps/dav/lib/Files/Xml/FilterRequest.php - About 2 hrs to fix

              Method createFile has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function createFile($name, $data = null) {
                      # the check here is necessary, because createFile uses put covered in sabre/file.php
                      # and not touch covered in files/view.php
                      if (Filesystem::isForbiddenFileOrDir($name)) {
                          throw new SabreForbidden();
              Severity: Minor
              Found in apps/dav/lib/Connector/Sabre/Directory.php - About 2 hrs to fix

                Method opendir has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function opendir($path) {
                        $folder = $this->getDriveFile($path);
                        if ($folder) {
                            $files = [];
                            $duplicates = [];
                Severity: Minor
                Found in apps/files_external/lib/Lib/Storage/Google.php - About 2 hrs to fix

                  Method getVersions has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function getVersions($uid, $filename) {
                          $versions = [];
                          if ($filename === null || $filename === '') {
                              return $versions;
                          }
                  Severity: Minor
                  Found in apps/files_versions/lib/Storage.php - About 2 hrs to fix

                    Method parseRetentionObligation has 50 lines of code (exceeds 25 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 2 hrs to fix

                      Method getSharedWith has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function getSharedWith($userId, $shareType, $node, $limit, $offset) {
                              /** @var Share[] $shares */
                              $shares = [];
                      
                              if ($shareType === \OCP\Share::SHARE_TYPE_USER) {
                      Severity: Minor
                      Found in lib/private/Share20/DefaultShareProvider.php - About 2 hrs to fix

                        Method call has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static function call($parameters) {
                                $request = \OC::$server->getRequest();
                                $method = $request->getMethod();
                        
                                // Prepare the request variables
                        Severity: Minor
                        Found in lib/private/legacy/api.php - About 2 hrs to fix

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

                              protected function execute(InputInterface $input, OutputInterface $output): int {
                                  $appSteps = $this->getAppsRepairSteps($output);
                                  // Handle listing repair steps
                                  $steps = \array_merge(
                                      \OC\Repair::getRepairSteps(),
                          Severity: Minor
                          Found in core/Command/Maintenance/Repair.php - About 2 hrs to fix

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

                                                tags = _.chain(tags).filter(function(xmlvalue) {
                                                    return (xmlvalue.namespaceURI === OC.Files.Client.NS_OWNCLOUD && xmlvalue.nodeName.split(':')[1] === 'tag');
                                                }).map(function(xmlvalue) {
                                                    return xmlvalue.textContent || xmlvalue.text;
                                                }).value();
                            Severity: Major
                            Found in apps/files/js/tagsplugin.js and 1 other location - About 2 hrs to fix
                            apps/files_sharing/js/share.js on lines 122..126

                            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 75.

                            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 3 locations. Consider refactoring.
                            Open

                                            try {
                                                if (!Files.isFileNameValid(filename)) {
                                                    // Files.isFileNameValid(filename) throws an exception itself
                                                } else if (self.fileList.inList(filename)) {
                                                    throw t('files', '{newname} already exists', {newname: filename});
                            Severity: Major
                            Found in apps/files/js/newfilemenu.js and 2 other locations - About 2 hrs to fix
                            apps/files/js/filelist.js on lines 2384..2474
                            apps/files/js/filelist.js on lines 2479..2489

                            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 75.

                            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 3 locations. Consider refactoring.
                            Open

                                            try {
                                                checkInput();
                                                input.tooltip('hide');
                                                input.removeClass('error');
                                            } catch (error) {
                            Severity: Major
                            Found in apps/files/js/filelist.js and 2 other locations - About 2 hrs to fix
                            apps/files/js/filelist.js on lines 2384..2474
                            apps/files/js/newfilemenu.js on lines 156..170

                            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 75.

                            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 3 locations. Consider refactoring.
                            Open

                                            try {
                                                var newName = input.val().trim();
                                                input.tooltip('hide');
                                                form.remove();
                            
                            
                            Severity: Major
                            Found in apps/files/js/filelist.js and 2 other locations - About 2 hrs to fix
                            apps/files/js/filelist.js on lines 2479..2489
                            apps/files/js/newfilemenu.js on lines 156..170

                            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 75.

                            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

                                                data.shareTypes = _.chain(shareTypesProp).filter(function(xmlvalue) {
                                                    return (xmlvalue.namespaceURI === OC.Files.Client.NS_OWNCLOUD && xmlvalue.nodeName.split(':')[1] === 'share-type');
                                                }).map(function(xmlvalue) {
                                                    return parseInt(xmlvalue.textContent || xmlvalue.text, 10);
                                                }).value();
                            Severity: Major
                            Found in apps/files_sharing/js/share.js and 1 other location - About 2 hrs to fix
                            apps/files/js/tagsplugin.js on lines 188..192

                            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 75.

                            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

                                    if ($this->offsetGet($path) === null) {
                                        // TODO: chunking if more than 1000 properties
                                        $sql = self::SELECT_BY_PATH_STMT;
                            
                                        $whereValues = [$path];
                            Severity: Major
                            Found in apps/dav/lib/DAV/MiscCustomPropertiesBackend.php and 1 other location - About 2 hrs to fix
                            apps/dav/lib/DAV/FileCustomPropertiesBackend.php on lines 142..157

                            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 121.

                            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

                                    if ($this->offsetGet($fileId) === null) {
                                        // TODO: chunking if more than 1000 properties
                                        $sql = self::SELECT_BY_ID_STMT;
                                        $whereValues = [$fileId];
                                        $whereTypes = [null];
                            Severity: Major
                            Found in apps/dav/lib/DAV/FileCustomPropertiesBackend.php and 1 other location - About 2 hrs to fix
                            apps/dav/lib/DAV/MiscCustomPropertiesBackend.php on lines 88..104

                            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 121.

                            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

                            Severity
                            Category
                            Status
                            Source
                            Language