owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

Method addStorage has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function addStorage(IStorageConfig $newStorage) {
        $allStorages = $this->readConfig();

        $configId = $this->dbConfig->addMount(
            $newStorage->getMountPoint(),
Severity: Minor
Found in lib/private/Files/External/Service/StoragesService.php - About 1 hr to fix

    Method deleteOrphanEntries has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function deleteOrphanEntries(IOutput $output, $repairInfo, $deleteTable, $deleteId, $sourceTable, $sourceId, $sourceNullColumn) {
            $qb = $this->connection->getQueryBuilder();
    
            $qb->select('d.' . $deleteId)
                ->from($deleteTable, 'd')
    Severity: Minor
    Found in lib/private/Repair/CleanTags.php - About 1 hr to fix

      Method addQueryConditionsParentIdWrongPath has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function addQueryConditionsParentIdWrongPath($qb) {
              // thanks, VicDeo!
              if ($this->connection->getDatabasePlatform() instanceof MySqlPlatform) {
                  $concatFunction = $qb->createFunction("CONCAT(fcp.path, '/', fc.name)");
              } else {
      Severity: Minor
      Found in lib/private/Repair/RepairMismatchFileCachePath.php - About 1 hr to fix

        Method createShare has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function createShare($data) {
                $share = new Share($this->rootFolder, $this->userManager);
                $share->setId($data['id'])
                    ->setShareType((int)$data['share_type'])
                    ->setPermissions((int)$data['permissions'])
        Severity: Minor
        Found in lib/private/Share20/DefaultShareProvider.php - About 1 hr to fix

          Method cropAndFill has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function cropAndFill($image, $askedWidth, $askedHeight, $previewWidth, $previewHeight) {
                  if ($previewWidth > $askedWidth) {
                      $cropX = \floor(($previewWidth - $askedWidth) * 0.5);
                      $image->crop($cropX, 0, $askedWidth, $previewHeight);
                      $previewWidth = $askedWidth;
          Severity: Minor
          Found in lib/private/Preview.php - About 1 hr to fix

            Method findAppInDirectories has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function findAppInDirectories($appId) {
                    $sanitizedAppId = \OC_App::cleanAppId($appId);
                    if ($sanitizedAppId !== $appId) {
                        return false;
                    }
            Severity: Minor
            Found in lib/private/App/AppManager.php - About 1 hr to fix

              Method adjustStreamChunkSize has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function adjustStreamChunkSize($handle) {
                      $stream = $handle;
                      $metadata = \stream_get_meta_data($stream);
                      while ($metadata['stream_type'] === 'user-space') {
                          \stream_set_chunk_size($stream, 64 * 1024);
              Severity: Minor
              Found in lib/private/legacy/image.php - About 1 hr to fix

                Method getAccessList has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getAccessList($path) {
                        // Make sure that a share key is generated for the owner too
                        list($owner, $ownerPath) = $this->util->getUidAndFilename($path);
                
                        // always add owner to the list of users with access to the file
                Severity: Minor
                Found in lib/private/Encryption/File.php - About 1 hr to fix

                  Method decryptAll has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function decryptAll(InputInterface $input, OutputInterface $output, $user = '') {
                          $this->input = $input;
                          $this->output = $output;
                  
                          if ($user !== '' && $this->userManager->userExists($user) === false) {
                  Severity: Minor
                  Found in lib/private/Encryption/DecryptAll.php - About 1 hr to fix

                    Method syncHome has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function syncHome(Account $a, UserInterface $backend) {
                            // Fallback for backends that dont yet use the new interfaces
                            $providesHome = $backend instanceof IProvidesHomeBackend || $backend->implementsActions(\OC_User_Backend::GET_HOME);
                            $uid = $a->getUserId();
                            // Log when the backend returns a string that is a different home to the current value
                    Severity: Minor
                    Found in lib/private/User/SyncService.php - About 1 hr to fix

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

                          protected function update(IComment $comment) {
                              return $this->emittingCall(function () use (&$comment) {
                                  $qb = $this->dbConn->getQueryBuilder();
                                  $affectedRows = $qb
                                      ->update('comments')
                      Severity: Minor
                      Found in lib/private/Comments/Manager.php - About 1 hr to fix

                        Method getFileSizeViaCurl has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function getFileSizeViaCurl($fileName) {
                                if (\OC::$server->getIniWrapper()->getString('open_basedir') === '') {
                                    $pathParts = \explode('/', $fileName);
                                    $encodedPathParts = \array_map('rawurlencode', $pathParts);
                                    $encodedFileName = \implode('/', $encodedPathParts);
                        Severity: Minor
                        Found in lib/private/LargeFileHelper.php - About 1 hr to fix

                          Method insert has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function insert(IComment &$comment) {
                                  $qb = $this->dbConn->getQueryBuilder();
                                  $affectedRows = $qb
                                      ->insert('comments')
                                      ->values([
                          Severity: Minor
                          Found in lib/private/Comments/Manager.php - About 1 hr to fix

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

                                protected function execute(InputInterface $input, OutputInterface $output): int {
                                    // collate config setting to the end, to avoid partial configuration
                                    $toBeSet = [];
                            
                                    if ($backend = $input->getOption('backend')) {
                            Severity: Minor
                            Found in core/Command/Log/Manage.php - About 1 hr to fix

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

                                  public function execute($command, $token, $params = []) {
                                      try {
                                          $this->validateRequest($command, $token);
                              
                                          $output = new BufferedOutput();
                              Severity: Minor
                              Found in core/Controller/OccController.php - About 1 hr to fix

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

                                                    if(!data.forwardedForHeadersWorking) {
                                                        messages.push({
                                                            msg: t('core', 'The reverse proxy headers configuration is incorrect, or you are accessing ownCloud from a trusted proxy. If you are not accessing ownCloud from a trusted proxy, this is a security issue and can allow an attacker to spoof their IP address as visible to ownCloud. Further information can be found in our <a target="_blank" rel="noreferrer" href="{docLink}">documentation</a>.', {docLink: data.reverseProxyDocs}),
                                                            type: OC.SetupChecks.MESSAGE_TYPE_WARNING
                                                        });
                                Severity: Major
                                Found in core/js/setupchecks.js and 2 other locations - About 1 hr to fix
                                core/js/setupchecks.js on lines 101..106
                                core/js/setupchecks.js on lines 107..112

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

                                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

                                                    if(!data.isUrandomAvailable) {
                                                        messages.push({
                                                            msg: t('core', '/dev/urandom is not readable by PHP which is highly discouraged for security reasons. Further information can be found in our <a target="_blank" rel="noreferrer" href="{docLink}">documentation</a>.', {docLink: data.securityDocs}),
                                                            type: OC.SetupChecks.MESSAGE_TYPE_WARNING
                                                        });
                                Severity: Major
                                Found in core/js/setupchecks.js and 2 other locations - About 1 hr to fix
                                core/js/setupchecks.js on lines 101..106
                                core/js/setupchecks.js on lines 125..130

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

                                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

                                                    if(!data.isMemcacheConfigured) {
                                                        messages.push({
                                                            msg: t('core', 'No memory cache has been configured. To enhance your performance please configure a memcache if available. Further information can be found in our <a target="_blank" rel="noreferrer" href="{docLink}">documentation</a>.', {docLink: data.memcacheDocs}),
                                                            type: OC.SetupChecks.MESSAGE_TYPE_INFO
                                                        });
                                Severity: Major
                                Found in core/js/setupchecks.js and 2 other locations - About 1 hr to fix
                                core/js/setupchecks.js on lines 107..112
                                core/js/setupchecks.js on lines 125..130

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

                                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 processSharesToConfirm has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        processSharesToConfirm: function() {
                                            var fileList = this.filesApp.fileList;
                                            // check for new server-to-server shares which need to be approved
                                            $.get(OC.generateUrl('/apps/files_sharing/api/externalShares'),
                                            {},
                                Severity: Minor
                                Found in apps/files_sharing/js/external.js - About 1 hr to fix

                                  Function processIncomingShareFromUrl has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                          processIncomingShareFromUrl: function() {
                                              var fileList = this.filesApp.fileList;
                                              var params = OC.Util.History.parseUrlQuery();
                                              //manually add server-to-server share
                                              if (params.remote && params.token && params.owner && params.name) {
                                  Severity: Minor
                                  Found in apps/files_sharing/js/external.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language