owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

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

        try {
            $stmt = \OCP\DB::prepare('DELETE FROM `' . self::TAG_TABLE . '` '
                . 'WHERE `uid` = ?');
            $result = $stmt->execute([$arguments['uid']]);
            if (\OCP\DB::isError($result)) {
Severity: Major
Found in lib/private/Tags.php and 1 other location - About 2 hrs to fix
lib/private/Tags.php on lines 532..545

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

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

    getStorageConfig: function($tr) {
        var storageId = $tr.data('id');
        if (!storageId) {
            // new entry
            storageId = null;
Severity: Major
Found in apps/files_external/js/settings.js - About 2 hrs to fix

    Method setPassword has 64 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function setPassword($token, $userId, $password) {
            $user = $this->userManager->get($userId);
    
            if ($user === null) {
                $this->log->error('User: ' . $userId . ' does not exist.', ['app' => 'settings']);
    Severity: Major
    Found in settings/Controller/UsersController.php - About 2 hrs to fix

      Method sendLinkShareMail has 64 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function sendLinkShareMail($sender, $recipients, $link, $personalNote = null) {
              if ($this->config->getAppValue('core', 'shareapi_allow_public_notification', 'no') !== 'yes') {
                  $message_t = $this->l->t('Public link mail notification is not allowed');
                  throw new GenericShareException($message_t, $message_t, 403);
              }
      Severity: Major
      Found in lib/private/Share/MailNotifications.php - About 2 hrs to fix

        Method lock has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function lock($storageId, $internalPath, $fileId, array $lockInfo) {
                if ($fileId <= 0) {
                    throw new \InvalidArgumentException('Invalid file id');
                }
                if (!isset($lockInfo['token'])) {
        Severity: Major
        Found in lib/private/Lock/Persistent/LockManager.php - About 2 hrs to fix

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

              function rename() {
                  $("#fileList tr").each(function(index) {
                      if ($(this).hasClass("mouseOver")) {
                          $(this).removeClass("mouseOver");
                          $(this).find("a[data-action='Rename']").trigger('click');
          Severity: Major
          Found in apps/files/js/keyboardshortcuts.js and 2 other locations - About 2 hrs to fix
          apps/files/js/keyboardshortcuts.js on lines 101..108
          apps/files/js/keyboardshortcuts.js on lines 110..117

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

          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

              function enter() {
                  $("#fileList tr").each(function(index) {
                      if ($(this).hasClass("mouseOver")) {
                          $(this).removeClass("mouseOver");
                          $(this).find("span.nametext").trigger('click');
          Severity: Major
          Found in apps/files/js/keyboardshortcuts.js and 2 other locations - About 2 hrs to fix
          apps/files/js/keyboardshortcuts.js on lines 110..117
          apps/files/js/keyboardshortcuts.js on lines 119..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 86.

          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

              function del() {
                  $("#fileList tr").each(function(index) {
                      if ($(this).hasClass("mouseOver")) {
                          $(this).removeClass("mouseOver");
                          $(this).find("a.action.delete").trigger('click');
          Severity: Major
          Found in apps/files/js/keyboardshortcuts.js and 2 other locations - About 2 hrs to fix
          apps/files/js/keyboardshortcuts.js on lines 101..108
          apps/files/js/keyboardshortcuts.js on lines 119..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 86.

          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 modelToSelection (model) {
                  var data = model.toJSON();
                  if (!OC.isUserAdmin()) {
                      /**
                       * If tag cannot be assigned just lock it.
          Severity: Major
          Found in apps/systemtags/js/systemtagsinfoview.js and 1 other location - About 2 hrs to fix
          apps/systemtags/js/systemtagstabview.js on lines 22..34

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

          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 modelToSelection (model) {
                  var data = model.toJSON();
                  if (!OC.isUserAdmin()) {
                      /**
                       * If tag cannot be assigned just lock it.
          Severity: Major
          Found in apps/systemtags/js/systemtagstabview.js and 1 other location - About 2 hrs to fix
          apps/systemtags/js/systemtagsinfoview.js on lines 13..25

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

          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

              public function __construct(
                  Tree $tree,
                  View $view,
                  ISystemTagManager $tagManager,
                  ISystemTagObjectMapper $tagMapper,
          Severity: Major
          Found in apps/dav/lib/Connector/Sabre/FilesReportPlugin.php and 2 other locations - About 2 hrs to fix
          apps/dav/lib/Connector/Sabre/ServerFactory.php on lines 76..94
          apps/federation/lib/Panels/Admin.php on lines 52..70

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

          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

              public function __construct(
                  IDBConnection $connection,
                  IL10N $l,
                  IClientService $clientService,
                  ILogger $logger,
          Severity: Major
          Found in apps/federation/lib/Panels/Admin.php and 2 other locations - About 2 hrs to fix
          apps/dav/lib/Connector/Sabre/FilesReportPlugin.php on lines 107..125
          apps/dav/lib/Connector/Sabre/ServerFactory.php on lines 76..94

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

          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

              public function __construct(
                  IConfig $config,
                  ILogger $logger,
                  IDBConnection $databaseConnection,
                  IUserSession $userSession,
          Severity: Major
          Found in apps/dav/lib/Connector/Sabre/ServerFactory.php and 2 other locations - About 2 hrs to fix
          apps/dav/lib/Connector/Sabre/FilesReportPlugin.php on lines 107..125
          apps/federation/lib/Panels/Admin.php on lines 52..70

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

          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

          File filesharing.php has 272 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /** @var \OCP\IL10N $l */
          /** @var array $_ */
          ?>
          <div id="shareAPI" class="section">
          Severity: Minor
          Found in settings/templates/panels/admin/filesharing.php - About 2 hrs to fix

            File Server.php has 272 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /**
             * @author Christoph Wurst <christoph@owncloud.com>
             * @author Georg Ehrke <georg@owncloud.com>
             * @author Lukas Reschke <lukas@statuscode.ch>
            Severity: Minor
            Found in apps/dav/lib/Server.php - About 2 hrs to fix

              Function submit has 63 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  submit: function() {
                      var self = this;
                      var data = this.data;
                      var file = this.getFile();
              
              
              Severity: Major
              Found in apps/files/js/file-upload.js - About 2 hrs to fix

                Function avatar has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    $.fn.avatar = function(user, size, ie8fix, hidedefault, callback, displayname) {
                        if (typeof(size) === 'undefined') {
                            if (this.height() > 0) {
                                size = this.height();
                            } else if (this.data('size') > 0) {
                Severity: Major
                Found in core/js/jquery.avatar.js - About 2 hrs to fix

                  Method setupDatabase has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function setupDatabase($username) {
                          $e_host = \addslashes($this->dbHost);
                          $e_user = \addslashes($this->dbUser);
                          $e_password = \addslashes($this->dbPassword);
                  
                  
                  Severity: Major
                  Found in lib/private/Setup/PostgreSQL.php - About 2 hrs to fix

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

                        public function __construct($server, $protocolVersion='HTTP/1.1') {
                            $this->server = $server;
                            $this->protocolVersion = $protocolVersion;
                    
                            $this->headers = [
                    Severity: Major
                    Found in lib/private/AppFramework/Http.php - About 2 hrs to fix

                      prototype has 23 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      OC.FileUpload.prototype = {
                      
                          /**
                           * Unique upload id
                           *
                      Severity: Minor
                      Found in apps/files/js/file-upload.js - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language