owncloud/core

View on GitHub
core/js/sharedialogshareelistview.js

Summary

Maintainability
D
2 days
Test Coverage

File sharedialogshareelistview.js has 432 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/sharedialogshareelistview.js - About 6 hrs to fix

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

            render: function() {
                var self = this;
    
                // render shares list in a container
                this.$el.html(this.template({
    Severity: Major
    Found in core/js/sharedialogshareelistview.js - About 2 hrs to fix

      Function getShareeList has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              getShareeList: function() {
                  var universal = {
                      avatarEnabled: this.configModel.areAvatarsEnabled(),
                      mailNotificationEnabled: this.configModel.isMailNotificationEnabled(),
                      notifyByMailLabel: t('core', 'notify by email'),
      Severity: Minor
      Found in core/js/sharedialogshareelistview.js - About 1 hr to fix

        Function getShareeObject has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                getShareeObject: function(shareIndex) {
                    var shareWith = this.model.getShareWith(shareIndex);
                    var shareWithDisplayName = this.model.getShareWithDisplayName(shareIndex);
                    var shareType = this.model.getShareType(shareIndex);
                    var shareWithAdditionalInfo = this.model.getShareWithAdditionalInfo(shareIndex);
        Severity: Minor
        Found in core/js/sharedialogshareelistview.js - About 1 hr to fix

          Function onPermissionChange has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  onPermissionChange: function(event) {
                      var $element = $(event.target);
                      var $li = $element.closest('li');
                      var shareId = $li.data('share-id');
                      var shareType = $li.data('share-type');
          Severity: Minor
          Found in core/js/sharedialogshareelistview.js - About 1 hr to fix

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

                        this.$el.find('.expiration-user:not(.hasDatepicker)').each(function(){
                            self._setDatepicker(this, {
                                maxDate  : self.configModel.getDefaultExpireDateUser(),
                                enforced : self.configModel.isDefaultExpireDateUserEnforced()
                            });
            Severity: Major
            Found in core/js/sharedialogshareelistview.js and 2 other locations - About 1 hr to fix
            core/js/sharedialogshareelistview.js on lines 322..327
            core/js/sharedialogshareelistview.js on lines 329..334

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

            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

                        this.$el.find('.expiration-remote:not(.hasDatepicker)').each(function(){
                            self._setDatepicker(this, {
                                maxDate  : self.configModel.getDefaultExpireDateRemote(),
                                enforced : self.configModel.isDefaultExpireDateRemoteEnforced()
                            });
            Severity: Major
            Found in core/js/sharedialogshareelistview.js and 2 other locations - About 1 hr to fix
            core/js/sharedialogshareelistview.js on lines 315..320
            core/js/sharedialogshareelistview.js on lines 322..327

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

            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

                        this.$el.find('.expiration-group:not(.hasDatepicker)').each(function(){
                            self._setDatepicker(this, {
                                maxDate  : self.configModel.getDefaultExpireDateGroup(),
                                enforced : self.configModel.isDefaultExpireDateGroupEnforced()
                            });
            Severity: Major
            Found in core/js/sharedialogshareelistview.js and 2 other locations - About 1 hr to fix
            core/js/sharedialogshareelistview.js on lines 315..320
            core/js/sharedialogshareelistview.js on lines 329..334

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

            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/sharedialogshareelistview.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/sharedialoglinkshareview.js on lines 374..379
            core/js/sharedialoglinksocialview.js on lines 99..104
            core/js/sharedialogmailview.js on lines 251..256

            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

            There are no issues that match your filters.

            Category
            Status