owncloud/core

View on GitHub
core/js/sharedialoglinkshareview.js

Summary

Maintainability
D
2 days
Test Coverage

File sharedialoglinkshareview.js has 322 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright (c) 2015
 *
 * This file is licensed under the Affero General Public License version 3
 * or later.
Severity: Minor
Found in core/js/sharedialoglinkshareview.js - About 3 hrs to fix

    Function _save has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            _save: function () {
                var deferred = $.Deferred();
                var $el = this.$el;
    
                var $formElements       = $el.find('input, textarea, select, button'),
    Severity: Major
    Found in core/js/sharedialoglinkshareview.js - About 2 hrs to fix

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

              render: function () {
                  var isPasswordSet = !!this.model.get('encryptedPassword');
      
                  // only show email field for new shares and if enabled globally
                  var showEmailField = this.configModel.isMailPublicNotificationEnabled();
      Severity: Major
      Found in core/js/sharedialoglinkshareview.js - About 2 hrs to fix

        Function show has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                show: function() {
                    var self = this;
                    var title = t('core', 'Edit link share: {name}', {name: this.itemModel.getFileInfo().getFullPath()});
                    var buttons = [{
                        text: t('core', 'Cancel'),
        Severity: Minor
        Found in core/js/sharedialoglinkshareview.js - About 1 hr to fix

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

                  '<div class="error-message-global hidden"></div>' +
                  '<div class="public-link-modal">'+
                      '<div class="public-link-modal--item">' +
                          '<label class="public-link-modal--label">{{linkNameLabel}}</label>' +
                          '<input class="public-link-modal--input" type="text" name="linkName" placeholder="{{namePlaceholder}}" value="{{name}}" maxlength="64" />' +
          Severity: Major
          Found in core/js/sharedialoglinkshareview.js and 1 other location - About 5 hrs to fix
          core/js/sharedialoglinklistview.js on lines 17..54

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

          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

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

                      if (!_.isUndefined(options.itemModel)) {
                          this.itemModel = options.itemModel;
                          this.configModel = this.itemModel.configModel;
                      } else {
                          throw 'missing OC.Share.ShareItemModel';
          Severity: Major
          Found in core/js/sharedialoglinkshareview.js and 1 other location - About 1 hr to fix
          core/js/sharedialoglinkexpirationview.js on lines 58..63

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

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

                  template: function (data) {
                      if (!this._template) {
                          this._template = Handlebars.compile(TEMPLATE);
                      }
                      return this._template(data);
          Severity: Major
          Found in core/js/sharedialoglinkshareview.js and 7 other locations - About 1 hr to fix
          apps/files_sharing/js/PublicUploadView.js on lines 124..129
          apps/files_sharing/js/PublicUploadView.js on lines 135..140
          core/js/sharedialoglinkexpirationview.js on lines 166..171
          core/js/sharedialoglinklistview.js on lines 297..302
          core/js/sharedialoglinksocialview.js on lines 99..104
          core/js/sharedialogmailview.js on lines 251..256
          core/js/sharedialogshareelistview.js on lines 364..369

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

          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.model.get('permissions') >= (OC.PERMISSION_READ | OC.PERMISSION_UPDATE | OC.PERMISSION_CREATE | OC.PERMISSION_DELETE)) {
          Severity: Minor
          Found in core/js/sharedialoglinkshareview.js and 1 other location - About 30 mins to fix
          core/js/sharedialoglinkshareview.js on lines 309..309

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

          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

                          buttons.push({
                              text: t('core', 'Save'),
                              click: _.bind(this._onClickSave, this),
                              defaultButton: true
                          })
          Severity: Minor
          Found in core/js/sharedialoglinkshareview.js and 1 other location - About 30 mins to fix
          core/js/sharedialoglinkshareview.js on lines 394..398

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

          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

                          publicFolderReadWriteSelected    : this.model.get('permissions') >= (OC.PERMISSION_READ | OC.PERMISSION_UPDATE | OC.PERMISSION_CREATE | OC.PERMISSION_DELETE),
          Severity: Minor
          Found in core/js/sharedialoglinkshareview.js and 1 other location - About 30 mins to fix
          core/js/sharedialoglinkshareview.js on lines 448..448

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

          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

                          buttons.push({
                              text: t('core', 'Share'),
                              click: _.bind(this._onClickSave, this),
                              defaultButton: true
                          })
          Severity: Minor
          Found in core/js/sharedialoglinkshareview.js and 1 other location - About 30 mins to fix
          core/js/sharedialoglinkshareview.js on lines 401..405

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

          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

          There are no issues that match your filters.

          Category
          Status